Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ WOFTongue()

void Terraria.Player.WOFTongue ( )
inline

Definition at line 21298 of file Player.cs.

21299 {
21300 if (Main.wofNPCIndex < 0 || !Main.npc[Main.wofNPCIndex].active)
21301 {
21302 return;
21303 }
21304 float num = Main.npc[Main.wofNPCIndex].position.X + 40f;
21305 if (Main.npc[Main.wofNPCIndex].direction > 0)
21306 {
21307 num -= 96f;
21308 }
21309 if (position.X + (float)width > num && position.X < num + 140f && gross)
21310 {
21311 noKnockback = false;
21312 int attackDamage_ScaledByStrength = Main.npc[Main.wofNPCIndex].GetAttackDamage_ScaledByStrength(50f);
21313 Hurt(PlayerDeathReason.LegacyDefault(), attackDamage_ScaledByStrength, Main.npc[Main.wofNPCIndex].direction);
21314 }
21315 if (!gross && position.Y > (float)((Main.maxTilesY - 250) * 16) && position.X > num - 1920f && position.X < num + 1920f)
21316 {
21317 AddBuff(37, 10);
21318 SoundEngine.PlaySound(4, (int)Main.npc[Main.wofNPCIndex].position.X, (int)Main.npc[Main.wofNPCIndex].position.Y, 10);
21319 }
21320 if (gross)
21321 {
21322 if (position.Y < (float)(Main.UnderworldLayer * 16))
21323 {
21324 AddBuff(38, 10);
21325 }
21326 if (Main.npc[Main.wofNPCIndex].direction < 0)
21327 {
21328 if (position.X + (float)(width / 2) > Main.npc[Main.wofNPCIndex].position.X + (float)(Main.npc[Main.wofNPCIndex].width / 2) + 40f)
21329 {
21330 AddBuff(38, 10);
21331 }
21332 }
21333 else if (position.X + (float)(width / 2) < Main.npc[Main.wofNPCIndex].position.X + (float)(Main.npc[Main.wofNPCIndex].width / 2) - 40f)
21334 {
21335 AddBuff(38, 10);
21336 }
21337 }
21338 if (!tongued)
21339 {
21340 return;
21341 }
21342 controlHook = false;
21343 controlUseItem = false;
21344 for (int i = 0; i < 1000; i++)
21345 {
21346 if (Main.projectile[i].active && Main.projectile[i].owner == Main.myPlayer && Main.projectile[i].aiStyle == 7)
21347 {
21348 Main.projectile[i].Kill();
21349 }
21350 }
21351 Vector2 center = base.Center;
21352 float num2 = Main.npc[Main.wofNPCIndex].position.X + (float)(Main.npc[Main.wofNPCIndex].width / 2) - center.X;
21353 float num3 = Main.npc[Main.wofNPCIndex].position.Y + (float)(Main.npc[Main.wofNPCIndex].height / 2) - center.Y;
21354 if ((float)Math.Sqrt(num2 * num2 + num3 * num3) > 3000f)
21355 {
21356 KillMe(PlayerDeathReason.ByOther(11), 1000.0, 0);
21357 }
21358 else if (Main.npc[Main.wofNPCIndex].position.X < 608f || Main.npc[Main.wofNPCIndex].position.X > (float)((Main.maxTilesX - 38) * 16))
21359 {
21360 KillMe(PlayerDeathReason.ByOther(12), 1000.0, 0);
21361 }
21362 }
static double Sqrt(double d)
static void PlaySound(int type, Vector2 position, int style=1)
static PlayerDeathReason ByOther(int type)
Vector2 position
Definition Entity.cs:14
void KillMe(PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp=false)
Definition Player.cs:36665
double Hurt(PlayerDeathReason damageSource, int Damage, int hitDirection, bool pvp=false, bool quiet=false, bool Crit=false, int cooldownCounter=-1, bool dodgeable=true)
Definition Player.cs:36134
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Definition Player.cs:4441
bool controlUseItem
Definition Player.cs:1391

References Terraria.DataStructures.PlayerDeathReason.ByOther(), Terraria.DataStructures.PlayerDeathReason.LegacyDefault(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.myPlayer, Terraria.Main.npc, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.projectile, System.Math.Sqrt(), Terraria.Main.UnderworldLayer, and Terraria.Main.wofNPCIndex.