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

◆ AI_187_ShadowHand()

void Terraria.Projectile.AI_187_ShadowHand ( )
inlineprivate

Definition at line 34541 of file Projectile.cs.

34542 {
34543 //IL_0041: Unknown result type (might be due to invalid IL or missing references)
34544 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
34545 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
34546 //IL_0058: Unknown result type (might be due to invalid IL or missing references)
34547 //IL_005d: Unknown result type (might be due to invalid IL or missing references)
34550 SlotId val;
34551 if (fakeCounter == 0f)
34552 {
34553 float[] array = localAI;
34555 array[1] = ((SlotId)(ref val)).ToFloat();
34556 }
34558 if (activeSound == null)
34559 {
34560 float[] array2 = localAI;
34561 val = SlotId.Invalid;
34562 array2[1] = ((SlotId)(ref val)).ToFloat();
34563 }
34564 else
34565 {
34566 activeSound.Position = base.Center;
34567 }
34568 float num = counterMax - 15f;
34569 if (fakeCounter > num)
34570 {
34571 alpha += 25;
34572 if (alpha > 255)
34573 {
34574 alpha = 255;
34575 }
34576 }
34577 else
34578 {
34579 alpha -= 25;
34580 if (alpha < 50)
34581 {
34582 alpha = 50;
34583 }
34584 }
34585 if (fakeCounter >= counterMax - 1f)
34586 {
34587 Kill();
34588 return;
34589 }
34590 if (variation == 0)
34591 {
34592 velocity *= 0.98f;
34593 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
34594 rotation = velocity.ToRotation();
34595 if (spriteDirection == -1)
34596 {
34597 rotation += (float)Math.PI;
34598 }
34599 }
34600 if (variation == 1)
34601 {
34602 float num2 = 70f;
34603 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
34604 if (velocity.Length() > 0.1f)
34605 {
34606 velocity *= 0.95f;
34607 }
34608 num2 *= (float)direction;
34609 Vector2 vector = base.Center - rotation.ToRotationVector2() * num2;
34610 float num3 = Utils.Remap(fromValue, 0.3f, 0.5f, 0f, 1f) * Utils.Remap(fromValue, 0.45f, 0.5f, 1f, 0f);
34611 float num4 = Utils.Remap(fromValue, 0.5f, 0.55f, 0f, 1f) * Utils.Remap(fromValue, 0.5f, 1f, 1f, 0f);
34612 float num5 = num3 * (float)Math.PI * 1f / 60f;
34613 num5 += num4 * -(float)Math.PI * 8f / 60f;
34614 rotation += num5 * (float)(-direction);
34616 base.Center = vector + rotation.ToRotationVector2() * num2;
34617 }
34618 if (variation == 2)
34619 {
34620 float f = ai[1];
34621 float num6 = Utils.Remap(fromValue, 0f, 0.4f, 1f, 0f);
34622 float num7 = Utils.Remap(fromValue, 0.3f, 0.4f, 0f, 1f) * Utils.Remap(fromValue, 0.4f, 1f, 1f, 0f);
34623 float num8 = num6 * 2f + num7 * 8f + 0.01f;
34624 velocity = f.ToRotationVector2() * num8;
34625 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
34626 rotation = velocity.ToRotation();
34627 if (spriteDirection == -1)
34628 {
34629 rotation += (float)Math.PI;
34630 }
34631 }
34632 if (variation == 3)
34633 {
34634 float num9 = ai[1];
34635 velocity = velocity.RotatedBy(num9);
34636 direction = (spriteDirection = ((velocity.X > 0f) ? 1 : (-1)));
34637 rotation = velocity.ToRotation();
34638 if (spriteDirection == -1)
34639 {
34640 rotation += (float)Math.PI;
34641 }
34642 }
34643 ai[0] += 1f;
34644 }
static float WrapAngle(float angle)
Definition MathHelper.cs:87
const double PI
Definition Math.cs:16
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
static ActiveSound GetActiveSound(SlotId id)
Vector2 velocity
Definition Entity.cs:16
static readonly LegacySoundStyle DD2_GhastlyGlaiveImpactGhost
Definition SoundID.cs:938
void AI_187_ShadowHand_GetVariation(out int variation, out float fakeCounter, out float counterMax)
static readonly SlotId Invalid
Definition SlotId.cs:5
static SlotId FromFloat(float value)
Definition SlotId.cs:80

References System.array, Terraria.ID.SoundID.DD2_GhastlyGlaiveImpactGhost, ReLogic.Utilities.SlotId.FromFloat(), Terraria.Audio.SoundEngine.GetActiveSound(), ReLogic.Utilities.SlotId.Invalid, System.Math.PI, Terraria.Audio.SoundEngine.PlayTrackedSound(), Terraria.Utils.Remap(), and Microsoft.Xna.Framework.MathHelper.WrapAngle().