Exemplo n.º 1
0
 public override void OnHitByAttack(AttackCollisionData xAtColData, AttackPhase xAtPhase)
 {
     if (xAtPhase.xStats.iBreakingPower >= this.xOwner.xBaseStats.iKnockbackResistance && (this.enCurrentAction == FrostlingBossAI.Action.Walkin || this.enCurrentAction == FrostlingBossAI.Action.Chillin || this.enCurrentAction == FrostlingBossAI.Action.NormalAttack))
     {
         this.iNextHardUpdate = 34;
         this.enCurrentAction = FrostlingBossAI.Action.TakingDamage;
     }
     if (xAtPhase.xOwner != null && Vector2.Distance(xAtPhase.xOwner.GetTrueOwner().xTransform.v2Pos, this.xOwner.xTransform.v2Pos) < 40f)
     {
         this.iCounterAtLastDashSnowball -= 10;
     }
     if (!this.bGonnaDie)
     {
         this.v2RandMoveDir = Vector2.Zero;
     }
     base.OnHitByAttack(xAtColData, xAtPhase);
     NetworkHelperInterface.NetworkRole arg_BA_0 = Program.game.xNetworkInfo.enCurrentRole;
 }
Exemplo n.º 2
0
 public override void OnUpdate()
 {
     this.iCounter++;
     this.iNextHardUpdate--;
     this.iExisted++;
     if (this.bGonnaDie)
     {
         this.MoveInDeath();
         return;
     }
     if (this.iExisted < 60)
     {
         return;
     }
     if (this.enCurrentAction == FrostlingBossAI.Action.TakingDamage || this.enCurrentAction == FrostlingBossAI.Action.NormalAttack)
     {
         if (this.iNextHardUpdate == 0)
         {
             this.enCurrentAction = FrostlingBossAI.Action.Chillin;
         }
         return;
     }
     if ((this.enCurrentAction == FrostlingBossAI.Action.Chillin || this.enCurrentAction == FrostlingBossAI.Action.Walkin) && this.iNextHardUpdate <= 0)
     {
         float fDistanceToTarget = 100000f;
         WorldActor xClosestTarget = base.FindTarget(EnemyBehaviour.TargetSearchParameters.Closest, this.fAggroDistance + (float)((this.xPlayerLockedOnto != null) ? 150 : 0), true, out fDistanceToTarget);
         if (xClosestTarget != null)
         {
             if (this.enCurrentAction == FrostlingBossAI.Action.Chillin)
             {
                 this.enCurrentAction = FrostlingBossAI.Action.Walkin;
             }
         }
         else
         {
             if (this.xPlayerLockedOnto != null)
             {
                 this.v2RandMoveDir = Vector2.Zero;
             }
             this.enCurrentAction = FrostlingBossAI.Action.Chillin;
             this.xOwner.xRenderComponent.SwitchAnimation((ushort)this.xOwner.byAnimationDirection);
         }
         this.xPlayerLockedOnto = xClosestTarget;
         float fClosestItem = 10000f;
         foreach (Item xItem in Program.game.dixItemList.Values)
         {
             if (xItem.bTakeAble && xItem.enType >= ItemCodex.ItemTypes._Coin_BigSilver && xItem.enType <= ItemCodex.ItemTypes._Coin_BigGold)
             {
                 int iMaxDistance = 100;
                 if (xItem.enType == ItemCodex.ItemTypes._Coin_SmallGold)
                 {
                     iMaxDistance = 150;
                 }
                 float fThisDist = Vector2.Distance(xItem.xTransform.v2Pos, this.xOwner.xTransform.v2Pos);
                 if (fThisDist <= (float)iMaxDistance && fThisDist <= fClosestItem && !base.Raycast(xItem.xTransform.v2Pos))
                 {
                     fClosestItem = fThisDist;
                 }
             }
         }
         this.iNextHardUpdate = 20;
     }
     if (this.xOwner.xRenderComponent.GetCurrentAnimation().bIsMoveCancellable && this.v2RandMoveDir != Vector2.Zero)
     {
         this.xOwner.xTransform.v2Pos += this.v2RandMoveDir * this.xOwner.xBaseStats.fMovementSpeed;
         if (this.xOwner.xRenderComponent.iActiveAnimation < 8)
         {
             this.xOwner.xRenderComponent.SwitchAnimation((ushort)(4 + Utility.ConvertV2DirectionToClosestByteDirection(this.v2RandMoveDir)), Animation.CancelOptions.IgnoreIfPlaying);
         }
     }
     if (this.xPlayerLockedOnto != null)
     {
         this.ChangeSpeed(0);
         if (this.enCurrentAction == FrostlingBossAI.Action.Walkin)
         {
             float fDistance = Vector2.Distance(this.xOwner.xTransform.v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos);
             float fMaxAttackDistance = 40f;
             this.enCurrentAction = FrostlingBossAI.Action.Walkin;
             if (this.iCounterAtLastDashAttack < this.iExisted - 600 + CAS.DifficultyModifier * 40 + CAS.DifficultySetting * 60)
             {
                 this.xOwner.xBaseStats.iKnockbackResistance = 11;
                 this.iCounterAtLastDashAttack = this.iExisted;
                 this.iCounter = 0;
                 this.enCurrentAction = FrostlingBossAI.Action.SpecialAttack_BuildUp;
                 byte byDir = Utility.ConvertV2DirectionToClosestByteDirection(Utility.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos));
                 this.xOwner.xRenderComponent.SwitchAnimation((ushort)(16 + byDir));
                 this.v2RandMoveDir = Vector2.Zero;
                 return;
             }
             if (this.iCounterAtLastDashSnowball < this.iExisted - 600 + CAS.DifficultyModifier * 30)
             {
                 this.xOwner.xBaseStats.iKnockbackResistance = 11;
                 this.iCounterAtLastDashSnowball = this.iExisted;
                 this.iCounter = 0;
                 this.enCurrentAction = FrostlingBossAI.Action.SnowMachineGun_JumpPrepare;
                 float fJumpDistance = 150f;
                 int iOffset = CAS.RandomInLogic.Next(16);
                 Vector2 v2ChosenTarget = Vector2.Zero;
                 for (int i = 0; i < 16; i++)
                 {
                     int iReal = (iOffset + i) % 16;
                     float fCurRad = 0.3926991f * (float)iReal;
                     Vector2 v2Dir = Utility.RadiansToVector2(fCurRad);
                     Vector2 v2Pos = this.xPlayerLockedOnto.xTransform.v2Pos + v2Dir * fJumpDistance;
                     if (!Program.game._CollisionMaster_RayCastVsStatic(v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos, 10f, 3, this.xPlayerLockedOnto.xCollisionComponent.ibitCurrentColliderLayer))
                     {
                         v2ChosenTarget = v2Pos;
                         break;
                     }
                 }
                 if (v2ChosenTarget == Vector2.Zero)
                 {
                     return;
                 }
                 this.v2JumpTarget = v2ChosenTarget;
                 byte byDir2 = Utility.ConvertV2DirectionToClosestByteDirection(Utility.Normalize(this.v2JumpTarget - this.xOwner.xTransform.v2Pos));
                 this.xOwner.xRenderComponent.SwitchAnimation((ushort)(24 + byDir2));
                 this.v2RandMoveDir = Vector2.Zero;
                 return;
             }
             else if (fDistance > fMaxAttackDistance)
             {
                 Vector2 v2RawDir = Utility.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos);
                 Utility.ConvertV2DirectionToClosestByteDirection(v2RawDir);
                 if (this.iCounter % 20 == 0)
                 {
                     if (Program.game._CollisionMaster_RayCastVsStatic(this.xOwner.xTransform.v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos, 3f, 3, Utility.CreateIntMask(new int[]
                     {
                         30
                     })))
                     {
                         List<PathFindingSystem.PFNode> lxTempPath = Program.game.xLevelMaster.xPathFinding.FindPath(this.xOwner.xTransform.v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos);
                         if (lxTempPath != null && (this.lxPath == null || (!lxTempPath.Contains(this.lxPath[0]) && PathFindingSystem.PathLengthSquared(this.lxPath) > PathFindingSystem.PathLengthSquared(lxTempPath))))
                         {
                             this.lxPath = lxTempPath;
                         }
                     }
                     else
                     {
                         this.lxPath = null;
                     }
                 }
                 if (this.lxPath == null)
                 {
                     this.v2RandMoveDir = Utility.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos + v2RawDir * 20f - this.xOwner.xTransform.v2Pos);
                     return;
                 }
                 this.v2RandMoveDir = Vector2.Lerp(this.v2RandMoveDir, Utility.Normalize(this.lxPath[0].v2Position - this.xOwner.xTransform.v2Pos), 0.1f);
                 if (Vector2.Distance(this.lxPath[0].v2Position, this.xOwner.xTransform.v2Pos) <= this.xOwner.xBaseStats.fMovementSpeed)
                 {
                     this.lxPath.RemoveAt(0);
                     if (this.lxPath.Count == 0)
                     {
                         this.lxPath = null;
                         return;
                     }
                 }
             }
             else if (MathHelper.Distance(this.xOwner.xTransform.v2Pos.X, this.xPlayerLockedOnto.xTransform.v2Pos.X) < 7f)
             {
                 this.enCurrentAction = FrostlingBossAI.Action.NormalAttack;
                 this.iNextHardUpdate = 90 - 10 * CAS.DifficultyModifier;
                 if (this.iNextHardUpdate < 50)
                 {
                     this.iNextHardUpdate = 50;
                 }
                 if (this.xOwner.xTransform.v2Pos.Y < this.xPlayerLockedOnto.xTransform.v2Pos.Y)
                 {
                     Program.game._Enemy_EnterAttackAnimation(this.xOwner, 10);
                     this.v2RandMoveDir = Vector2.Zero;
                     return;
                 }
                 Program.game._Enemy_EnterAttackAnimation(this.xOwner, 8);
                 this.v2RandMoveDir = Vector2.Zero;
                 return;
             }
             else if (MathHelper.Distance(this.xOwner.xTransform.v2Pos.Y, this.xPlayerLockedOnto.xTransform.v2Pos.Y) < 7f)
             {
                 this.enCurrentAction = FrostlingBossAI.Action.NormalAttack;
                 this.iNextHardUpdate = 90 - 10 * CAS.DifficultyModifier;
                 if (this.iNextHardUpdate < 50)
                 {
                     this.iNextHardUpdate = 50;
                 }
                 if (this.xOwner.xTransform.v2Pos.X < this.xPlayerLockedOnto.xTransform.v2Pos.X)
                 {
                     Program.game._Enemy_EnterAttackAnimation(this.xOwner, 9);
                     this.v2RandMoveDir = Vector2.Zero;
                     return;
                 }
                 Program.game._Enemy_EnterAttackAnimation(this.xOwner, 11);
                 this.v2RandMoveDir = Vector2.Zero;
                 return;
             }
         }
         else
         {
             if (this.enCurrentAction == FrostlingBossAI.Action.SpecialAttack_BuildUp)
             {
                 return;
             }
             if (this.enCurrentAction == FrostlingBossAI.Action.SpecialAttack_Go)
             {
                 if (this.iCounter < 8)
                 {
                     Program.game._EffectMaster_AddEffect(new VFX_GenericGhostImage(this.xOwner.xTransform.v2Pos, this.xOwner.xRenderComponent));
                     Vector2 v2Dist = this.v2DashTarget - this.v2DashSource;
                     v2Dist /= 8f;
                     this.xOwner.xTransform.v2Pos += v2Dist;
                     return;
                 }
                 if (this.iCounter == 8)
                 {
                     this.xOwner.xCollisionComponent.ActivateGroup(CollisionComponent.ColliderGroup.Movement);
                     return;
                 }
                 if (this.iCounter >= 60)
                 {
                     this.enCurrentAction = FrostlingBossAI.Action.Chillin;
                     this.xOwner.xBaseStats.iKnockbackResistance = -1;
                     return;
                 }
             }
             else if (this.enCurrentAction == FrostlingBossAI.Action.SnowMachineGun_Jump)
             {
                 if (this.iCounter < 8)
                 {
                     Program.game._EffectMaster_AddEffect(new VFX_GenericGhostImage(this.xOwner.xTransform.v2Pos, this.xOwner.xRenderComponent));
                     Vector2 v2Dist2 = this.v2JumpTarget - this.v2JumpSource;
                     v2Dist2 /= 8f;
                     this.xOwner.xTransform.v2Pos += v2Dist2;
                     return;
                 }
                 if (this.iCounter == 8)
                 {
                     this.xOwner.xCollisionComponent.ActivateGroup(CollisionComponent.ColliderGroup.Movement);
                     return;
                 }
                 if (this.iCounter == 20)
                 {
                     if (this.xPlayerLockedOnto != null)
                     {
                         this.enCurrentAction = FrostlingBossAI.Action.SnowMachineGun_Go;
                         byte byDir3 = Utility.ConvertV2DirectionToClosestByteDirection(Utility.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos));
                         this.xOwner.xRenderComponent.SwitchAnimation((ushort)(28 + byDir3));
                         this.iSnowBallsToThrow = 24 + ((CAS.DifficultySetting > 0) ? 14 : 0);
                         return;
                     }
                     this.xOwner.xRenderComponent.SwitchAnimation((ushort)this.xOwner.byAnimationDirection);
                     this.enCurrentAction = FrostlingBossAI.Action.Chillin;
                     this.xOwner.xBaseStats.iKnockbackResistance = -1;
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 public override void OnAnimationCallback(AnimationInstruction xIns)
 {
     if (CAS.NetworkRole == NetworkHelperInterface.NetworkRole.Client)
     {
         return;
     }
     if (xIns.xEvent.afAlterableValues[0] == 0f)
     {
         this.enCurrentAction = FrostlingBossAI.Action.SpecialAttack_Go;
         this.iCounter = 0;
         this.v2DashSource = this.xOwner.xTransform.v2Pos;
         if (this.xPlayerLockedOnto != null)
         {
             this.v2DashTarget = this.xPlayerLockedOnto.xTransform.v2Pos;
         }
         else
         {
             this.v2DashTarget = this.xOwner.xTransform.v2Pos;
         }
         byte byDir = Utility.ConvertV2DirectionToClosestByteDirection(Utility.Normalize(this.v2DashTarget - this.v2DashSource));
         Program.game._Enemy_EnterAttackAnimation(this.xOwner, (ushort)(20 + byDir));
         this.xOwner.xCollisionComponent.DeactivateGroup(CollisionComponent.ColliderGroup.Movement);
         return;
     }
     if (xIns.xEvent.afAlterableValues[0] == 1f)
     {
         this.enCurrentAction = FrostlingBossAI.Action.SnowMachineGun_Jump;
         this.iCounter = 0;
         this.v2JumpSource = this.xOwner.xTransform.v2Pos;
         this.xOwner.xCollisionComponent.DeactivateGroup(CollisionComponent.ColliderGroup.Movement);
         return;
     }
     if (xIns.xEvent.afAlterableValues[0] == 2f)
     {
         if (this.xPlayerLockedOnto != null && this.iSnowBallsToThrow > 0)
         {
             this.enCurrentAction = FrostlingBossAI.Action.SnowMachineGun_Go;
             byte byDir2 = Utility.ConvertV2DirectionToClosestByteDirection(Utility.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos));
             this.xOwner.xRenderComponent.SwitchAnimation((ushort)(32 + byDir2), Animation.CancelOptions.RestartIfPlaying);
             this.iSnowBallsToThrow--;
             this.ThrowSnowBall(Utility.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos));
             return;
         }
         this.xOwner.xRenderComponent.SwitchAnimation((ushort)this.xOwner.byAnimationDirection);
         this.enCurrentAction = FrostlingBossAI.Action.Chillin;
         this.iNextHardUpdate = 60;
         this.xOwner.xBaseStats.iKnockbackResistance = -1;
     }
 }