Esempio n. 1
0
 public override void OnAttackHit(AttackCollisionData xAtColData, BaseStats xBaseStats)
 {
     if (!xAtColData.bShielded)
     {
         if (Program.GetTheGame().bEffectsOn)
         {
             IEffect kaktus = Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(xAtColData.v2PointOfImpact, SortedAnimated.SortedAnimatedEffects._HitEffect_Pang1));
             kaktus.xRenderComponent.fVirtualHeight += this.xOwner.xRenderComponent.fVirtualHeight;
             kaktus.xRenderComponent.xTransform = xBaseStats.xOwner.xTransform;
             kaktus.xRenderComponent.v2OffsetRenderPos = new Vector2(0f, -10f);
             return;
         }
     }
     else if (xBaseStats.iPerfectGuardBonus > 0)
     {
         this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
         this.iSubPecks = 0;
         this.iNextHardUpdate = 120 - 15 * Program.GetTheGame().dixPlayers.Count;
     }
 }
Esempio n. 2
0
 public override void OnClientUpdate()
 {
     this.xRCHead.Update();
     foreach (RenderComponent x in this.lxBallz)
     {
         x.fAlpha = this.xOwner.xRenderComponent.fAlpha;
     }
     if (this.xRCHead != null)
     {
         this.xRCHead.fAlpha = this.xOwner.xRenderComponent.fAlpha;
     }
     if (!this.bInited)
     {
         this.bInited = true;
         this.v2CoreHeadPos = this.v2RelaxedHeadOffset;
     }
     if (this.iKillCounter > 0)
     {
         this.iKillCounter++;
         if (this.iKillCounter == 40)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.xRCHead);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.xRCHead.v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.xRCHead.v2OffsetRenderPos, 5);
         }
         if (this.iKillCounter == 48)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[4]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[4].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[4].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 56)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[3]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[3].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[3].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 64)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[2]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[2].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[2].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 72)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[1]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[1].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[1].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 80)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[0]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[0].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[0].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 120)
         {
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + new Vector2(-5f, -5f), SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + new Vector2(5f, -5f), SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + new Vector2(0f, -15f), SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.xOwner.iDeathCountdown = 1;
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + new Vector2(0f, -10f), 10);
         }
         return;
     }
     if (this.v2HeadMoveDir != Vector2.Zero)
     {
         this.v2CoreHeadPos += this.v2HeadMoveDir * this.fHeadSpeed;
     }
     this.xRCHead.Update();
     if (this.dilv2NeckOffsets.ContainsKey(this.xOwner.xRenderComponent.iActiveAnimation) && this.xOwner.xRenderComponent.fPassedTicks > 0f)
     {
         this.v2CurrentSourceOffset = this.dilv2NeckOffsets[this.xOwner.xRenderComponent.iActiveAnimation][this.xOwner.xRenderComponent.GetCurrentAnimation().iRenderedFrame] + this.xOwner.xRenderComponent.v2OffsetRenderPos;
     }
     this.xRCHead.v2OffsetRenderPos = this.v2CoreHeadPos + this.xOwner.xRenderComponent.v2OffsetRenderPos / 2f;
     Vector2 v2StartPoint = this.v2CurrentSourceOffset;
     Vector2 v2EndPoint = this.xRCHead.v2OffsetRenderPos + new Vector2((float)(-4 * this.LookingDirMod()), 1f);
     this.lxBallz[0].v2OffsetRenderPos = Vector2.Lerp(v2StartPoint, v2EndPoint, 0.05f);
     for (int i = 1; i < 5; i++)
     {
         this.lxBallz[i].v2OffsetRenderPos = Vector2.Lerp(v2StartPoint, v2EndPoint, 0.05f + 0.2f * (float)i);
     }
     this.lxBallz[4].v2OffsetRenderPos = Vector2.Lerp(v2StartPoint, v2EndPoint, 0.87f);
     float fArchBackMod = 1f;
     if (fArchBackMod > 0f)
     {
         Vector2 v2Archback = new Vector2((float)(-4 * this.LookingDirMod()), -3f);
         float fGrade = 1f - Vector2.Distance(v2StartPoint, v2EndPoint) / 50f;
         v2Archback *= fGrade;
         if (fGrade > 0f)
         {
             this.lxBallz[4].v2OffsetRenderPos += v2Archback * fArchBackMod * 0.6f;
             this.lxBallz[3].v2OffsetRenderPos += v2Archback * fArchBackMod * 0.85f;
             this.lxBallz[2].v2OffsetRenderPos += v2Archback * fArchBackMod * 0.9f;
             this.lxBallz[1].v2OffsetRenderPos += v2Archback * fArchBackMod * 0.7f;
         }
         if (v2EndPoint.X > v2StartPoint.Y)
         {
             Vector2 v2Archback2 = new Vector2((float)(-4 * this.LookingDirMod()), 1f);
             fGrade = (v2StartPoint.X - v2EndPoint.X) / 10f;
             if (fGrade > 1f)
             {
                 fGrade = 1f;
             }
             v2Archback2 *= fGrade;
             if (fGrade > 0f)
             {
                 this.lxBallz[4].v2OffsetRenderPos += v2Archback2 * fArchBackMod * 0.5f;
                 this.lxBallz[3].v2OffsetRenderPos += v2Archback2 * fArchBackMod * 0.7f;
                 this.lxBallz[2].v2OffsetRenderPos += v2Archback2 * fArchBackMod * 0.6f;
                 this.lxBallz[1].v2OffsetRenderPos += v2Archback2 * fArchBackMod * 0.4f;
             }
         }
     }
     this.xBeakTransform.v2Pos = this.xOwner.xTransform.v2Pos + this.xRCHead.v2OffsetRenderPos + this.BeakOffset();
     if (this.enCurrentAction == BirdieAI.BirdieAction.ChillinSoon || this.enCurrentAction == BirdieAI.BirdieAction.Chillin || this.enCurrentAction == BirdieAI.BirdieAction.Walkin || this.enCurrentAction == BirdieAI.BirdieAction.Flying)
     {
         Vector2 v2NewTarget = Vector2.Zero;
         Vector2 v2Dif = this.v2CurrentSourceOffset - this.v2PreviousHeadOffset;
         if (this.v2CurrentSourceOffset != Vector2.Zero && v2Dif != Vector2.Zero)
         {
             v2NewTarget = Vector2.Normalize(v2Dif);
         }
         if (this.v2CoreHeadPos.Y > -20f)
         {
             v2NewTarget.Y = -3f;
         }
         else if (this.v2CoreHeadPos.Y > -32f)
         {
             v2NewTarget.Y = -0.5f;
         }
         else if (this.v2CoreHeadPos.Y < -49f)
         {
             v2NewTarget.Y = 0.45f;
         }
         if (this.xOwner.byAnimationDirection == 1)
         {
             if (this.v2CoreHeadPos.X > 48f)
             {
                 v2NewTarget.X = -((float)Program.GetTheGame().randomInVisual.NextDouble() * 0.5f + 2f);
             }
             else if (this.v2CoreHeadPos.X > 42f)
             {
                 v2NewTarget.X = -((float)Program.GetTheGame().randomInVisual.NextDouble() * 0.1f + 0.15f);
             }
             else if (this.v2CoreHeadPos.X < 30f)
             {
                 v2NewTarget.X = (float)Program.GetTheGame().randomInVisual.NextDouble() * 0.1f + 0.5f;
             }
             else if (this.v2CoreHeadPos.X < 10f)
             {
                 v2NewTarget.X = (float)Program.GetTheGame().randomInVisual.NextDouble() * 0.1f + 2f;
             }
         }
         else if (this.v2CoreHeadPos.X < -48f)
         {
             v2NewTarget.X = (float)Program.GetTheGame().randomInVisual.NextDouble() * 0.5f + 2f;
         }
         else if (this.v2CoreHeadPos.X > -30f)
         {
             v2NewTarget.X = -((float)Program.GetTheGame().randomInVisual.NextDouble() * 0.1f + 0.5f);
         }
         else if (this.v2CoreHeadPos.X > -10f)
         {
             v2NewTarget.X = -((float)Program.GetTheGame().randomInVisual.NextDouble() * 0.1f + 2f);
         }
         else if (this.v2CoreHeadPos.X < -40f)
         {
             v2NewTarget.X = (float)Program.GetTheGame().randomInVisual.NextDouble() * 0.1f + 0.15f;
         }
         if (v2NewTarget != Vector2.Zero)
         {
             this.v2HeadMoveDir = Vector2.Lerp(this.v2HeadMoveDir, v2NewTarget, 0.2f);
         }
         else
         {
             this.v2HeadMoveDir = Vector2.Lerp(this.v2HeadMoveDir, v2NewTarget, 0.03f);
         }
     }
     Program.GetTheGame().v2DebufV2lolo = this.v2HeadMoveDir;
     if (this.xOwner.xRenderComponent.iActiveAnimation == 4 || this.xOwner.xRenderComponent.iActiveAnimation == 5)
     {
         float fSpeedTurn = 4f;
         int iFrame = this.xOwner.xRenderComponent.GetCurrentAnimation().iRenderedFrame;
         if (this.xOwner.xRenderComponent.iActiveAnimation == 4)
         {
             if (iFrame == 0)
             {
                 Vector2 v2WantPos = new Vector2(12f, -36f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
             else if (iFrame == 1)
             {
                 Vector2 v2WantPos2 = new Vector2(8f, -32f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos2 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 if (this.xRCHead.iActiveAnimation < 4)
                 {
                     this.SwitchHeadAnimation(3);
                 }
             }
             else if (iFrame == 2)
             {
                 Vector2 v2WantPos3 = new Vector2(2f, -28f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos3 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 this.SwitchHeadAnimation(4);
             }
             else if (iFrame == 3)
             {
                 Vector2 v2WantPos4 = new Vector2(-8f, -28f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos4 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 this.SwitchHeadAnimation(5);
             }
             else if (iFrame == 4)
             {
                 Vector2 v2WantPos5 = new Vector2(-12f, -32f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos5 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
             else if (iFrame == 5)
             {
                 Vector2 v2WantPos6 = new Vector2(-16f, -36f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos6 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
         }
         else if (this.xOwner.xRenderComponent.iActiveAnimation == 5)
         {
             if (iFrame == 0)
             {
                 Vector2 v2WantPos7 = new Vector2(-12f, -36f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos7 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
             else if (iFrame == 1)
             {
                 Vector2 v2WantPos8 = new Vector2(-8f, -32f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos8 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 if (this.xRCHead.iActiveAnimation > 4)
                 {
                     this.SwitchHeadAnimation(5);
                 }
             }
             else if (iFrame == 2)
             {
                 Vector2 v2WantPos9 = new Vector2(-2f, -28f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos9 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 this.SwitchHeadAnimation(4);
             }
             else if (iFrame == 3)
             {
                 Vector2 v2WantPos10 = new Vector2(8f, -28f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos10 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 this.SwitchHeadAnimation(3);
             }
             else if (iFrame == 4)
             {
                 Vector2 v2WantPos11 = new Vector2(12f, -32f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos11 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
             else if (iFrame == 5)
             {
                 Vector2 v2WantPos12 = new Vector2(16f, -36f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos12 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.GoingForNormalAttack)
     {
         this.v2HeadMoveDir *= 0.95f;
         if (this.bIsElite)
         {
             this.v2HeadMoveDir *= 0.95f;
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.InPeck)
     {
         if (this.v2HeadMoveDir != Vector2.Zero && Vector2.Distance(this.xRCHead.v2OffsetRenderPos + this.v2HeadMoveDir, this.v2PeckTarget) > Vector2.Distance(this.xRCHead.v2OffsetRenderPos, this.v2PeckTarget))
         {
             Program.game._EffectMaster_AddEffect(new SortedAnimated(this.xBeakTransform.v2Pos, SortedAnimated.SortedAnimatedEffects._EnemyEffects_Pecko_Peck));
             Program.game._EffectMaster_AddEffect(new SortedAnimated(this.xBeakTransform.v2Pos, SortedAnimated.SortedAnimatedEffects._EnemyEffects_Pecko_Hole));
             this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
             this.v2HeadMoveDir = Vector2.Normalize(new Vector2(-this.v2RelaxedHeadOffset.X, this.v2RelaxedHeadOffset.Y) - this.xRCHead.v2OffsetRenderPos) * 6f;
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.Flying)
     {
         if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 14, 15))
         {
             if (this.iFlyHeightMeister > 0)
             {
                 AnimatedRenderComponent expr_10E5_cp_0 = this.xOwner.xRenderComponent;
                 expr_10E5_cp_0.v2OffsetRenderPos.Y = expr_10E5_cp_0.v2OffsetRenderPos.Y - (float)this.iFlyHeightMeister-- / 8f;
             }
         }
         else if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 12, 13))
         {
             this.v2RandMoveDir = Vector2.Zero;
         }
         else if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 16, 17) && this.iFlyHeightMeister > 0)
         {
             AnimatedRenderComponent expr_116F_cp_0 = this.xOwner.xRenderComponent;
             expr_116F_cp_0.v2OffsetRenderPos.Y = expr_116F_cp_0.v2OffsetRenderPos.Y + 1.2f;
             if (this.xOwner.xRenderComponent.v2OffsetRenderPos.Y >= 0f)
             {
                 this.xOwner.xRenderComponent.v2OffsetRenderPos.Y = 0f;
                 this.iFlyHeightMeister = 0;
                 this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
             }
         }
     }
     if (this.iPrevRegFrame != this.xOwner.xRenderComponent.GetCurrentAnimation().iRenderedFrame)
     {
         this.v2PreviousHeadOffset = this.v2CurrentSourceOffset;
         this.iPrevRegFrame = this.xOwner.xRenderComponent.GetCurrentAnimation().iRenderedFrame;
     }
 }
Esempio n. 3
0
 public override void InstructionsFromServer(byte byInstructionID, params float[] afParams)
 {
     if (byInstructionID == 0)
     {
         this.xRCHead.SwitchAnimation((ushort)afParams[0], Animation.CancelOptions.IgnoreIfPlaying);
         return;
     }
     if (byInstructionID == 1)
     {
         this.v2HeadMoveDir = new Vector2(afParams[0], afParams[1]);
         this.enCurrentAction = BirdieAI.BirdieAction.GoingForNormalAttack;
         return;
     }
     if (byInstructionID == 2)
     {
         this.Peck(new Vector2(afParams[0], afParams[1]));
         return;
     }
     if (byInstructionID == 3)
     {
         this.xOwner.xBaseStats.fMovementSpeed = 1f + 0.2f * (float)GameSessionData.iBaseDifficulty;
         if (afParams[0] == 0f)
         {
             this.enCurrentAction = BirdieAI.BirdieAction.Turning;
             this.xOwner.xRenderComponent.SwitchAnimation(4, Animation.CancelOptions.IgnoreIfPlaying);
             return;
         }
         if (afParams[0] == 1f)
         {
             this.enCurrentAction = BirdieAI.BirdieAction.Turning;
             this.xOwner.xRenderComponent.SwitchAnimation(5, Animation.CancelOptions.IgnoreIfPlaying);
             return;
         }
     }
     else
     {
         if (byInstructionID == 4)
         {
             this.xOwner.xBaseStats.fMovementSpeed = 2f;
             this.v2HeadMoveDir = Vector2.Normalize(new Vector2(-this.v2RelaxedHeadOffset.X, this.v2RelaxedHeadOffset.Y) - this.xRCHead.v2OffsetRenderPos) * 6f;
             this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
             this.xOwner.xBaseStats.fMovementSpeed = 1f + 0.2f * (float)GameSessionData.iBaseDifficulty;
             return;
         }
         if (byInstructionID == 5)
         {
             this.xOwner.xBaseStats.fMovementSpeed = 2f;
             this.iFlyHeightMeister = 22;
             this.enCurrentAction = BirdieAI.BirdieAction.Flying;
             return;
         }
         if (byInstructionID == 6)
         {
             this.iFlyHeightMeister = 60;
             return;
         }
         if (byInstructionID == 7)
         {
             this.FlyingSpawn(new Vector2(afParams[0], afParams[1]));
         }
     }
 }
Esempio n. 4
0
 public override void OnAnimationCallback(AnimationInstruction xIns)
 {
     if (Program.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Client)
     {
         if (xIns.xEvent.afAlterableValues[0] == 5f)
         {
             float fDir = xIns.xEvent.afAlterableValues[1];
             if (this.xPeckAttackPhase != null)
             {
                 this.xPeckAttackPhase.UnregisterCurrent();
                 this.xPeckAttackPhase = null;
             }
             if (fDir == 0f)
             {
                 Program.game.xSoundSystem.PlayCue("Pecco_BackAttackFirst", this.xOwner, false);
                 Vector2 v2Offset = new Vector2(-12f, -7f);
                 Vector2 v2Offset2 = new Vector2(-22f, -3f);
                 if (this.xOwner.byAnimationDirection == 3)
                 {
                     v2Offset.X *= -1f;
                     v2Offset2.X *= -1f;
                     this.CreateSandEffect(new Vector2(0.6f, -0.4f));
                     this.CreateSandEffect(new Vector2(0.8f, -0.2f));
                     return;
                 }
                 this.CreateSandEffect(new Vector2(-0.6f, -0.4f));
                 this.CreateSandEffect(new Vector2(-0.8f, -0.2f));
                 return;
             }
             else if (fDir == 1f)
             {
                 Program.game.xSoundSystem.PlayCue("Pecco_BackAttackSecond", this.xOwner, false);
                 Vector2 v2Offset3 = new Vector2(-12f, 7f);
                 Vector2 v2Offset4 = new Vector2(-22f, 3f);
                 if (this.xOwner.byAnimationDirection == 3)
                 {
                     v2Offset3.X *= -1f;
                     v2Offset4.X *= -1f;
                     this.CreateSandEffect(new Vector2(0.6f, 0.4f));
                     this.CreateSandEffect(new Vector2(0.8f, 0.2f));
                     return;
                 }
                 this.CreateSandEffect(new Vector2(-0.6f, 0.4f));
                 this.CreateSandEffect(new Vector2(-0.8f, 0.2f));
                 return;
             }
         }
         else
         {
             if (xIns.xEvent.afAlterableValues[0] == 4f)
             {
                 Program.game.xRenderMaster.UnregisterRenderComponenent(this.xRCShadow);
                 this.xOwner.xRenderComponent.v2OffsetRenderPos.Y = 0f;
                 return;
             }
             if (xIns.xEvent.afAlterableValues[0] == 2f)
             {
                 Program.game.xRenderMaster.RegisterBelowSorted(this.xRCShadow);
             }
         }
         return;
     }
     if (xIns.xEvent.afAlterableValues[0] == 0f)
     {
         this.Peck();
         return;
     }
     if (xIns.xEvent.afAlterableValues[0] == 1f)
     {
         this.GoPeck();
         return;
     }
     if (xIns.xEvent.afAlterableValues[0] == 2f)
     {
         this.xOwner.xBaseStats.bUntargetable = true;
         this.xOwner.xCollisionComponent.SetPropertyInGroup(CollisionComponent.ColliderGroup.Movement, CollisionComponent.ColliderProperty.Ghost);
         this.xOwner.xCollisionComponent.DeactivateGroup(CollisionComponent.ColliderGroup.Combat);
         this.enCurrentAction = BirdieAI.BirdieAction.Flying;
         this.iNextHardUpdate = 300;
         this.iFlyHeightMeister = 22;
         this.bPrepareLand = false;
         this.xOwner.xBaseStats.fMovementSpeed = 2f;
         byte arg_32B_1 = 5;
         float[] afParams = new float[1];
         base.SendClientInstruction(arg_32B_1, afParams);
         Program.game.xRenderMaster.RegisterBelowSorted(this.xRCShadow);
         return;
     }
     if (xIns.xEvent.afAlterableValues[0] == 3f)
     {
         this.xOwner.xBaseStats.bUntargetable = false;
         this.xOwner.xCollisionComponent.SetPropertyInGroup(CollisionComponent.ColliderGroup.Movement, CollisionComponent.ColliderProperty.NonGhost);
         this.xOwner.xCollisionComponent.ActivateGroup(CollisionComponent.ColliderGroup.Combat);
         this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
         this.xOwner.xBaseStats.fMovementSpeed = 1f + 0.2f * (float)GameSessionData.iBaseDifficulty;
         if (this.FacingTarget())
         {
             if (this.xOwner.byAnimationDirection == 1)
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(0, Animation.CancelOptions.IgnoreIfPlaying);
             }
             else
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(1, Animation.CancelOptions.IgnoreIfPlaying);
             }
             base.SendClientInstruction(4, new float[0]);
             return;
         }
         if (this.xOwner.byAnimationDirection == 1)
         {
             this.xOwner.xRenderComponent.SwitchAnimation(4, Animation.CancelOptions.IgnoreIfPlaying);
             this.enCurrentAction = BirdieAI.BirdieAction.Turning;
             byte arg_3F5_1 = 3;
             float[] afParams2 = new float[1];
             base.SendClientInstruction(arg_3F5_1, afParams2);
             return;
         }
         this.xOwner.xRenderComponent.SwitchAnimation(5, Animation.CancelOptions.IgnoreIfPlaying);
         this.enCurrentAction = BirdieAI.BirdieAction.Turning;
         base.SendClientInstruction(3, new float[]
         {
             1f
         });
         return;
     }
     else
     {
         if (xIns.xEvent.afAlterableValues[0] == 4f)
         {
             this.v2RandMoveDir = Vector2.Zero;
             this.xOwner.xRenderComponent.v2OffsetRenderPos.Y = 0f;
             Program.game.xRenderMaster.UnregisterRenderComponenent(this.xRCShadow);
             return;
         }
         if (xIns.xEvent.afAlterableValues[0] == 5f)
         {
             float fDir2 = xIns.xEvent.afAlterableValues[1];
             if (fDir2 == 2f && this.xPeckAttackPhase != null)
             {
                 this.xPeckAttackPhase.UnregisterCurrent();
                 this.xPeckAttackPhase = null;
             }
             if (fDir2 == 0f)
             {
                 Program.game.xSoundSystem.PlayCue("Pecco_BackAttackFirst", this.xOwner, false);
                 Vector2 v2Offset5 = new Vector2(-12f, -7f);
                 Vector2 v2Offset6 = new Vector2(-22f, -3f);
                 if (this.xOwner.byAnimationDirection == 3)
                 {
                     v2Offset5.X *= -1f;
                     v2Offset6.X *= -1f;
                     this.CreateSandEffect(new Vector2(0.6f, -0.4f));
                     this.CreateSandEffect(new Vector2(0.8f, -0.2f));
                 }
                 else
                 {
                     this.CreateSandEffect(new Vector2(-0.6f, -0.4f));
                     this.CreateSandEffect(new Vector2(-0.8f, -0.2f));
                 }
                 this.xPeckAttackPhase = new AttackPhase(this.xOwner);
                 this.xPeckAttackPhase.lenLayers.Add(Collider.ColliderLayers.Players);
                 this.xPeckAttackPhase.lenLayers.Add(Collider.ColliderLayers.DynamicEnvironment);
                 SphereCollider col = new SphereCollider(12f, v2Offset5, this.xOwner.xTransform, 10000f, this.xOwner);
                 this.xPeckAttackPhase.lxCurrentColliders.Add(col);
                 col = new SphereCollider(12f, v2Offset6, this.xOwner.xTransform, 10000f, this.xOwner);
                 this.xPeckAttackPhase.lxCurrentColliders.Add(col);
                 col.xAttackPhase = this.xPeckAttackPhase;
                 this.xPeckAttackPhase.xStats.iBreakingPower = 5;
                 this.xPeckAttackPhase.xStats.fKnockBack = 15f;
                 this.xPeckAttackPhase.xStats.iBaseDamage = 15 + this.xOwner.xBaseStats.iBaseATK;
                 this.xPeckAttackPhase.xStats.enAttackElement = AttackStats.Element.Neutral;
                 this.xPeckAttackPhase.xStats.enAttackType = AttackStats.Type.Physical;
                 this.xPeckAttackPhase.xStats.bKnockbackShieldRedistribution = false;
                 this.xPeckAttackPhase.RegisterCurrent();
                 return;
             }
             if (fDir2 == 1f)
             {
                 Program.game.xSoundSystem.PlayCue("Pecco_BackAttackSecond", this.xOwner, false);
                 Vector2 v2Offset7 = new Vector2(-12f, 7f);
                 Vector2 v2Offset8 = new Vector2(-22f, 3f);
                 if (this.xOwner.byAnimationDirection == 3)
                 {
                     v2Offset7.X *= -1f;
                     v2Offset8.X *= -1f;
                     this.CreateSandEffect(new Vector2(0.6f, 0.4f));
                     this.CreateSandEffect(new Vector2(0.8f, 0.2f));
                 }
                 else
                 {
                     this.CreateSandEffect(new Vector2(-0.6f, 0.4f));
                     this.CreateSandEffect(new Vector2(-0.8f, 0.2f));
                 }
                 this.xPeckAttackPhase = new AttackPhase(this.xOwner);
                 this.xPeckAttackPhase.lenLayers.Add(Collider.ColliderLayers.Players);
                 this.xPeckAttackPhase.lenLayers.Add(Collider.ColliderLayers.DynamicEnvironment);
                 SphereCollider col2 = new SphereCollider(12f, v2Offset7, this.xOwner.xTransform, 10000f, this.xOwner);
                 this.xPeckAttackPhase.lxCurrentColliders.Add(col2);
                 col2 = new SphereCollider(12f, v2Offset8, this.xOwner.xTransform, 10000f, this.xOwner);
                 this.xPeckAttackPhase.lxCurrentColliders.Add(col2);
                 col2.xAttackPhase = this.xPeckAttackPhase;
                 this.xPeckAttackPhase.xStats.iBreakingPower = 5;
                 this.xPeckAttackPhase.xStats.fKnockBack = 15f;
                 this.xPeckAttackPhase.xStats.iBaseDamage = 15 + this.xOwner.xBaseStats.iBaseATK;
                 this.xPeckAttackPhase.xStats.enAttackElement = AttackStats.Element.Neutral;
                 this.xPeckAttackPhase.xStats.enAttackType = AttackStats.Type.Physical;
                 this.xPeckAttackPhase.xStats.bKnockbackShieldRedistribution = false;
                 this.xPeckAttackPhase.RegisterCurrent();
             }
         }
         return;
     }
 }
Esempio n. 5
0
 private void GoPeck()
 {
     this.bPickUpNext = false;
     byte byAnimAdd = 0;
     if (this.xOwner.byAnimationDirection == 3)
     {
         byAnimAdd = 1;
     }
     if (this.xPlayerLockedOnto != null)
     {
         this.bPickUpNext = (this.xPlayerLockedOnto.xTransform.v2Pos.Y < this.xOwner.xTransform.v2Pos.Y - 15f || (MathHelper.Distance(this.xPlayerLockedOnto.xTransform.v2Pos.X, this.xOwner.xTransform.v2Pos.X) < 30f && this.xPlayerLockedOnto.xTransform.v2Pos.Y < this.xOwner.xTransform.v2Pos.Y));
         this.v2AimAtPeckBuildUp = this.xPlayerLockedOnto.xTransform.v2Pos;
         this.iAgressionCounter -= 60;
         if (this.iAgressionCounter < 0)
         {
             this.iAgressionCounter = 0;
         }
         this.enCurrentAction = BirdieAI.BirdieAction.GoingForNormalAttack;
         Vector2 v2TargetDir = new Vector2(3f, -48f) - this.xRCHead.v2OffsetRenderPos;
         this.xOwner.xRenderComponent.SwitchAnimation((ushort)(2 + byAnimAdd), Animation.CancelOptions.IgnoreIfPlaying);
         if (this.bPickUpNext)
         {
             v2TargetDir.Y += 40f;
         }
         float fDistance = v2TargetDir.Length();
         if (v2TargetDir != Vector2.Zero)
         {
             v2TargetDir.Normalize();
             this.v2HeadMoveDir = v2TargetDir * 3f * (fDistance / 30f);
             if (this.bIsElite)
             {
                 this.v2HeadMoveDir *= 2f;
             }
         }
         base.SendClientInstruction(1, new float[]
         {
             this.v2HeadMoveDir.X,
             this.v2HeadMoveDir.Y
         });
         return;
     }
 }
Esempio n. 6
0
 public void FlyingSpawn(Vector2 v2TargetLocation)
 {
     this.xOwner.xCollisionComponent.DeactivateGroup(CollisionComponent.ColliderGroup.All);
     this.enCurrentAction = BirdieAI.BirdieAction.FlyingSpawn;
     this.v2FlyToPosition = v2TargetLocation;
     if (this.xOwner.xTransform.v2Pos.X < v2TargetLocation.X)
     {
         this.xOwner.xRenderComponent.SwitchAnimation(14, Animation.CancelOptions.IgnoreIfPlaying);
         this.xRCHead.SwitchAnimation(2, Animation.CancelOptions.IgnoreIfPlaying);
     }
     else
     {
         this.xOwner.xRenderComponent.SwitchAnimation(15, Animation.CancelOptions.IgnoreIfPlaying);
         this.xRCHead.SwitchAnimation(6, Animation.CancelOptions.IgnoreIfPlaying);
     }
     this.xOwner.xBaseStats.bUntargetable = true;
     this.iFlyHeightMeister = 22;
     this.bPrepareLand = false;
     this.xOwner.xBaseStats.fMovementSpeed = 2f;
     Program.game._EntityMaster_AddWatcher(new FadeInRenderComponent(this.xOwner.xRenderComponent, 60));
 }
Esempio n. 7
0
 public override void PlayerRemovedFromPlay(WorldActor xActor)
 {
     if (this.xPlayerLockedOnto == xActor)
     {
         if (this.enCurrentAction == BirdieAI.BirdieAction.InPeck)
         {
             this.enCurrentAction = BirdieAI.BirdieAction.ChillinSoon;
             this.iNextHardUpdate = 60;
             base.SendClientInstruction(4, new float[0]);
             if (this.xRCHead.iActiveAnimation < 100)
             {
                 this.SwitchHeadAnimation((ushort)(16 + this.xRCHead.GetCurrentAnimation().byAnimationDirection));
             }
             this.v2HeadMoveDir = Vector2.Normalize(new Vector2(-this.v2RelaxedHeadOffset.X, this.v2RelaxedHeadOffset.Y) - this.xRCHead.v2OffsetRenderPos) * 6f;
         }
         this.xPlayerLockedOnto = null;
     }
 }
Esempio n. 8
0
 public void Peck(Vector2 v2Target)
 {
     base.SendClientInstruction(2, new float[]
     {
         v2Target.X,
         v2Target.Y
     });
     this.enCurrentAction = BirdieAI.BirdieAction.InPeck;
     byte byLookAt = this.byGetLookAt(v2Target);
     Vector2 v2TargetDir = v2Target - this.xRCHead.v2OffsetRenderPos;
     v2TargetDir.Length();
     if (v2TargetDir != Vector2.Zero)
     {
         v2TargetDir.Normalize();
         this.v2HeadMoveDir = v2TargetDir * 12f;
         if (Program.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Client)
         {
             this.v2HeadMoveDir *= 1.075f;
         }
     }
     this.xRCHead.SwitchAnimation((ushort)(byLookAt + 8), Animation.CancelOptions.IgnoreIfPlaying);
     this.v2PeckTarget = v2Target;
 }
Esempio n. 9
0
 public void Peck()
 {
     if (Program.GetTheGame().xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Client)
     {
         return;
     }
     bool bPeckedPlayer = false;
     Vector2 v2Target = new Vector2((float)(60 * this.LookingDirMod()), 0f);
     if (this.xPlayerLockedOnto != null)
     {
         bool bIsUp = this.xPlayerLockedOnto.xTransform.v2Pos.Y < this.xOwner.xTransform.v2Pos.Y - 15f || (MathHelper.Distance(this.xPlayerLockedOnto.xTransform.v2Pos.X, this.xOwner.xTransform.v2Pos.X) < 30f && this.xPlayerLockedOnto.xTransform.v2Pos.Y < this.xOwner.xTransform.v2Pos.Y);
         bool bGoodSide = (this.xOwner.byAnimationDirection == 1 && this.xOwner.xTransform.v2Pos.X < this.xPlayerLockedOnto.xTransform.v2Pos.X) || (this.xOwner.byAnimationDirection == 3 && this.xOwner.xTransform.v2Pos.X > this.xPlayerLockedOnto.xTransform.v2Pos.X);
         if (this.xPlayerLockedOnto != null && (this.bPickUpNext || !bIsUp) && (!this.bPickUpNext || bIsUp) && bGoodSide)
         {
             if (Vector2.Distance(this.xPlayerLockedOnto.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) < 100f)
             {
                 v2Target = (this.v2AimAtPeckBuildUp + this.xPlayerLockedOnto.xTransform.v2Pos) / 2f - this.xOwner.xTransform.v2Pos;
             }
             else
             {
                 v2Target = Vector2.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos) * 75f;
             }
             bPeckedPlayer = true;
         }
         else if (!bGoodSide)
         {
             if (this.xOwner.byAnimationDirection == 1)
             {
                 this.enCurrentAction = BirdieAI.BirdieAction.ChillinSoon;
                 this.xOwner.xRenderComponent.SwitchAnimation(6, Animation.CancelOptions.IgnoreIfPlaying);
                 if (this.xRCHead.iActiveAnimation > 7)
                 {
                     this.SwitchHeadAnimation((ushort)(this.xRCHead.GetCurrentAnimation().byAnimationDirection + 16));
                 }
                 this.iNextHardUpdate = 20;
                 this.iSubPecks = 0;
             }
             else
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(7, Animation.CancelOptions.IgnoreIfPlaying);
                 this.enCurrentAction = BirdieAI.BirdieAction.ChillinSoon;
                 if (this.xRCHead.iActiveAnimation > 7)
                 {
                     this.SwitchHeadAnimation((ushort)(this.xRCHead.GetCurrentAnimation().byAnimationDirection + 16));
                 }
                 this.iNextHardUpdate = 20;
                 this.iSubPecks = 0;
             }
             base.SendClientInstruction(4, new float[0]);
             return;
         }
     }
     if (!bPeckedPlayer)
     {
         this.iSubPecks = 0;
     }
     byte byLookAt = this.byGetLookAt(v2Target);
     Vector2 v2Mos = new Vector2(14f, 20f);
     this.iPeckCountdown = 3;
     if (byLookAt == 0)
     {
         v2Mos = new Vector2(0f, -3f);
         if ((v2Target - v2Mos).Y > -50f)
         {
             v2Target = Vector2.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos) * 55f;
             this.iPeckCountdown = 1;
         }
     }
     else if (byLookAt == 1)
     {
         v2Mos = new Vector2(16f, 15f);
     }
     else if (byLookAt == 3)
     {
         v2Mos = new Vector2(11f, 16f);
     }
     else if (byLookAt == 4)
     {
         v2Mos = new Vector2(0f, 17f);
     }
     else if (byLookAt == 5)
     {
         v2Mos = new Vector2(-11f, 16f);
     }
     else if (byLookAt == 6)
     {
         v2Mos = new Vector2(-14f, 20f);
     }
     else if (byLookAt == 7)
     {
         v2Mos = new Vector2(-16f, 15f);
     }
     this.Peck(v2Target - v2Mos);
 }
Esempio n. 10
0
 public override void OnUpdate()
 {
     if (this.xOwner.bToBeDestroyed)
     {
         return;
     }
     foreach (RenderComponent x in this.lxBallz)
     {
         x.fAlpha = this.xOwner.xRenderComponent.fAlpha;
     }
     if (this.xRCHead != null)
     {
         this.xRCHead.fAlpha = this.xOwner.xRenderComponent.fAlpha;
     }
     if (this.iKillCounter > 0)
     {
         this.iKillCounter++;
         if (this.iKillCounter == 40)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.xRCHead);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.xRCHead.v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.xRCHead.v2OffsetRenderPos, 5);
         }
         if (this.iKillCounter == 48)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[4]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[4].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[4].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 56)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[3]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[3].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[3].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 64)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[2]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[2].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[2].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 72)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[1]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[1].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[1].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 80)
         {
             Program.GetTheGame().xRenderMaster.UnregisterRenderComponenent(this.lxBallz[0]);
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + this.lxBallz[0].v2OffsetRenderPos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + this.lxBallz[0].v2OffsetRenderPos, 3);
         }
         if (this.iKillCounter == 120)
         {
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos, SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + new Vector2(-5f, -5f), SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + new Vector2(5f, -5f), SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xOwner.xTransform.v2Pos + new Vector2(0f, -15f), SortedAnimated.SortedAnimatedEffects.PoofEffectC));
             this.xOwner.iDeathCountdown = 1;
             this.AddHitEffect(this.xOwner.xTransform.v2Pos + new Vector2(0f, -10f), 10);
         }
         return;
     }
     Random knark = Program.GetTheGame().randomInLogic;
     if (!this.bInited)
     {
         this.bInited = true;
         this.v2CoreHeadPos = this.v2RelaxedHeadOffset;
     }
     this.BallUpdate();
     if (this.iAgressionCounter < 500 + 20 * Program.GetTheGame()._Enemy_GetDifficultyModifier())
     {
         this.iAgressionCounter++;
     }
     if (this.v2RandMoveDir != Vector2.Zero)
     {
         this.xOwner.xTransform.v2Pos += this.v2RandMoveDir * this.xOwner.xBaseStats.fMovementSpeed;
     }
     this.iNextHardUpdate--;
     this.iCounter++;
     if (this.enCurrentAction != BirdieAI.BirdieAction.InPeck && this.enCurrentAction != BirdieAI.BirdieAction.SandKick && this.xPeckAttackPhase != null)
     {
         this.xPeckAttackPhase.UnregisterCurrent();
         this.xPeckAttackPhase = null;
     }
     if (this.enCurrentAction == BirdieAI.BirdieAction.ChillinSoon)
     {
         if (this.iNextHardUpdate <= 0)
         {
             this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.Turning)
     {
         float fSpeedTurn = 4f;
         int iFrame = this.xOwner.xRenderComponent.GetCurrentAnimation().iRenderedFrame;
         if (this.xOwner.xRenderComponent.iActiveAnimation == 4)
         {
             if (iFrame == 0)
             {
                 Vector2 v2WantPos = new Vector2(12f, -36f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
             else if (iFrame == 1)
             {
                 Vector2 v2WantPos2 = new Vector2(8f, -32f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos2 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 if (this.xRCHead.iActiveAnimation < 4)
                 {
                     this.SwitchHeadAnimation(3);
                 }
             }
             else if (iFrame == 2)
             {
                 Vector2 v2WantPos3 = new Vector2(2f, -28f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos3 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 this.SwitchHeadAnimation(4);
             }
             else if (iFrame == 3)
             {
                 Vector2 v2WantPos4 = new Vector2(-8f, -28f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos4 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 this.SwitchHeadAnimation(5);
             }
             else if (iFrame == 4)
             {
                 Vector2 v2WantPos5 = new Vector2(-12f, -32f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos5 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
             else if (iFrame == 5)
             {
                 Vector2 v2WantPos6 = new Vector2(-16f, -36f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos6 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
         }
         else if (this.xOwner.xRenderComponent.iActiveAnimation == 5)
         {
             if (iFrame == 0)
             {
                 Vector2 v2WantPos7 = new Vector2(-12f, -36f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos7 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
             else if (iFrame == 1)
             {
                 Vector2 v2WantPos8 = new Vector2(-8f, -32f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos8 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 if (this.xRCHead.iActiveAnimation > 4)
                 {
                     this.SwitchHeadAnimation(5);
                 }
             }
             else if (iFrame == 2)
             {
                 Vector2 v2WantPos9 = new Vector2(-2f, -28f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos9 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 this.SwitchHeadAnimation(4);
             }
             else if (iFrame == 3)
             {
                 Vector2 v2WantPos10 = new Vector2(8f, -28f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos10 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
                 this.SwitchHeadAnimation(3);
             }
             else if (iFrame == 4)
             {
                 Vector2 v2WantPos11 = new Vector2(12f, -32f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos11 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
             else if (iFrame == 5)
             {
                 Vector2 v2WantPos12 = new Vector2(16f, -36f);
                 this.v2HeadMoveDir = Vector2.Normalize(v2WantPos12 - this.xRCHead.v2OffsetRenderPos) * fSpeedTurn;
             }
         }
         else if (this.bFlyAfterTurn)
         {
             if (this.xOwner.byAnimationDirection == 1)
             {
                 if (this.v2FlyToPosition.X > this.xOwner.xTransform.v2Pos.X)
                 {
                     this.xOwner.xRenderComponent.SwitchAnimation(12, Animation.CancelOptions.IgnoreIfPlaying);
                     this.SwitchHeadAnimation(2);
                     this.enCurrentAction = BirdieAI.BirdieAction.Flying;
                 }
             }
             else
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(13, Animation.CancelOptions.IgnoreIfPlaying);
                 this.SwitchHeadAnimation(6);
                 this.enCurrentAction = BirdieAI.BirdieAction.Flying;
             }
             this.bFlyAfterTurn = false;
         }
         else
         {
             this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
             base.SendClientInstruction(4, new float[0]);
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.Chillin)
     {
         float fDistanceToTarget = -1f;
         this.lxPath = null;
         if (this.xPlayerLockedOnto != null)
         {
             fDistanceToTarget = Vector2.Distance(this.xPlayerLockedOnto.xTransform.v2Pos, this.xOwner.xTransform.v2Pos);
             bool bSomeoneBehind = false;
             List<WorldActor> lxActors = Program.GetTheGame()._Enemy_GetTargetList(this, true);
             foreach (WorldActor x2 in lxActors)
             {
                 if (Vector2.Distance(x2.xTransform.v2Pos, this.xOwner.xTransform.v2Pos + new Vector2((float)(-15 * this.LookingDirMod()), 0f)) < 20f)
                 {
                     bSomeoneBehind = true;
                 }
             }
             if (bSomeoneBehind)
             {
                 this.enCurrentAction = BirdieAI.BirdieAction.SandKick;
                 if (this.xOwner.byAnimationDirection == 1)
                 {
                     this.xOwner.xRenderComponent.SwitchAnimation(18, Animation.CancelOptions.IgnoreIfPlaying);
                     this.SwitchHeadAnimation(5);
                     return;
                 }
                 this.xOwner.xRenderComponent.SwitchAnimation(19, Animation.CancelOptions.IgnoreIfPlaying);
                 this.SwitchHeadAnimation(3);
                 return;
             }
             else if (!this.FacingTarget() && this.xOwner.xRenderComponent.iActiveAnimation < 2 && this.iSubPecks == 0)
             {
                 if (this.xOwner.byAnimationDirection == 1)
                 {
                     if (this.xOwner.xTransform.v2Pos.X > this.xPlayerLockedOnto.xTransform.v2Pos.X)
                     {
                         this.enCurrentAction = BirdieAI.BirdieAction.Turning;
                         this.xOwner.xRenderComponent.SwitchAnimation(4, Animation.CancelOptions.IgnoreIfPlaying);
                         byte arg_B8F_1 = 3;
                         float[] afParams = new float[1];
                         base.SendClientInstruction(arg_B8F_1, afParams);
                     }
                 }
                 else if (this.xOwner.xTransform.v2Pos.X < this.xPlayerLockedOnto.xTransform.v2Pos.X)
                 {
                     this.enCurrentAction = BirdieAI.BirdieAction.Turning;
                     this.xOwner.xRenderComponent.SwitchAnimation(5, Animation.CancelOptions.IgnoreIfPlaying);
                     base.SendClientInstruction(3, new float[]
                     {
                         1f
                     });
                 }
             }
             else if (this.FacingTarget() && fDistanceToTarget > 75f)
             {
                 this.enCurrentAction = BirdieAI.BirdieAction.Walkin;
                 return;
             }
         }
         else if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 8, 11))
         {
             if (this.xOwner.byAnimationDirection == 1)
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(0, Animation.CancelOptions.IgnoreIfPlaying);
             }
             else
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(1, Animation.CancelOptions.IgnoreIfPlaying);
             }
             this.v2RandMoveDir = Vector2.Zero;
         }
         if (this.iNextHardUpdate <= 0)
         {
             int iSwitchWant = this.GetCurrentTargetPreference();
             if (iSwitchWant <= 1)
             {
                 this.GetNewTarget();
             }
             this.iNextHardUpdate = 40;
             if (this.xPlayerLockedOnto != null && Vector2.Distance(this.xPlayerLockedOnto.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) < this.fFurthestPeckDistance && this.FacingTarget() && (this.iAgressionCounter > 300 || knark.Next(3) == 0) && fDistanceToTarget < 100f)
             {
                 this.iSubPecks = 2;
                 this.GoPeck();
             }
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.SandKick)
     {
         if (this.xPeckAttackPhase != null && this.xPeckAttackPhase.lxCurrentColliders.Count > 1)
         {
             this.xPeckAttackPhase.lxCurrentColliders[0].xLocalTransform.v2Pos += Vector2.Normalize(this.xPeckAttackPhase.lxCurrentColliders[0].xLocalTransform.v2Pos) * 1.5f;
             this.xPeckAttackPhase.lxCurrentColliders[1].xLocalTransform.v2Pos += Vector2.Normalize(this.xPeckAttackPhase.lxCurrentColliders[1].xLocalTransform.v2Pos) * 1.5f;
         }
         if (!Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 18, 19))
         {
             this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.Walkin)
     {
         if (this.xPlayerLockedOnto == null)
         {
             this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
             return;
         }
         float fDistanceToTarget2 = Vector2.Distance(this.xPlayerLockedOnto.xTransform.v2Pos, this.xOwner.xTransform.v2Pos);
         if (fDistanceToTarget2 > 150f && this.FacingTarget() && this.iFliedAt + 600 < this.iCounter)
         {
             this.iFliedAt = this.iCounter;
             this.v2FlyToPosition = this.xPlayerLockedOnto.xTransform.v2Pos;
             this.v2FlyToPosition.Y = this.v2FlyToPosition.Y - 20f;
             if (this.xOwner.byAnimationDirection == 1)
             {
                 if (this.v2FlyToPosition.X > this.xOwner.xTransform.v2Pos.X)
                 {
                     this.xOwner.xRenderComponent.SwitchAnimation(12, Animation.CancelOptions.IgnoreIfPlaying);
                     this.SwitchHeadAnimation(2);
                     this.enCurrentAction = BirdieAI.BirdieAction.Flying;
                     return;
                 }
             }
             else
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(13, Animation.CancelOptions.IgnoreIfPlaying);
                 this.SwitchHeadAnimation(6);
                 this.enCurrentAction = BirdieAI.BirdieAction.Flying;
             }
             return;
         }
         if (this.iCounter % 20 == 0)
         {
             if (Program.GetTheGame()._CollisionMaster_RayCastVsStatic(this.xOwner.xTransform.v2Pos + Vector2.Normalize(this.xPlayerLockedOnto.xTransform.v2Pos - this.xOwner.xTransform.v2Pos) * 15f, this.xPlayerLockedOnto.xTransform.v2Pos, 5f, 3, Utility.CreateIntMask(new int[]
             {
                 30
             })))
             {
                 this.lxPath = Program.game.xLevelMaster.xPathFinding.FindPath(this.xOwner.xTransform.v2Pos, this.xPlayerLockedOnto.xTransform.v2Pos);
                 if (this.lxPath == null)
                 {
                 }
             }
             else
             {
                 this.lxPath = null;
             }
         }
         if (this.lxPath == null)
         {
             Vector2 v2ModifiedPos = this.xPlayerLockedOnto.xTransform.v2Pos;
             if (this.xPlayerLockedOnto.xTransform.v2Pos.X > this.xOwner.xTransform.v2Pos.X)
             {
                 v2ModifiedPos.X -= 37f;
             }
             else
             {
                 v2ModifiedPos.X += 37f;
             }
             Vector2 v2RawDir = Vector2.Normalize(v2ModifiedPos - this.xOwner.xTransform.v2Pos);
             this.v2RandMoveDir = v2RawDir;
         }
         else
         {
             this.v2RandMoveDir = Vector2.Lerp(this.v2RandMoveDir, Vector2.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;
                 }
             }
         }
         if (fDistanceToTarget2 < 60f || (!this.FacingTarget() && fDistanceToTarget2 > 40f))
         {
             this.enCurrentAction = BirdieAI.BirdieAction.Chillin;
             if (this.xOwner.byAnimationDirection == 1)
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(0, Animation.CancelOptions.IgnoreIfPlaying);
             }
             else
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(1, Animation.CancelOptions.IgnoreIfPlaying);
             }
             this.v2RandMoveDir = Vector2.Zero;
         }
         else if (this.xOwner.byAnimationDirection == 1)
         {
             if (this.v2RandMoveDir.X > 0f)
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(8, Animation.CancelOptions.IgnoreIfPlaying);
             }
             else
             {
                 this.xOwner.xRenderComponent.SwitchAnimation(10, Animation.CancelOptions.IgnoreIfPlaying);
             }
         }
         else if (this.v2RandMoveDir.X < 0f)
         {
             this.xOwner.xRenderComponent.SwitchAnimation(9, Animation.CancelOptions.IgnoreIfPlaying);
         }
         else
         {
             this.xOwner.xRenderComponent.SwitchAnimation(11, Animation.CancelOptions.IgnoreIfPlaying);
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.Flying || this.enCurrentAction == BirdieAI.BirdieAction.FlyingSpawn)
     {
         if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 14, 15))
         {
             if (this.v2FlyToPosition != this.xOwner.xTransform.v2Pos && !this.bPrepareLand)
             {
                 this.v2RandMoveDir = Vector2.Normalize(this.v2FlyToPosition - this.xOwner.xTransform.v2Pos);
             }
             if (Vector2.Distance(this.xOwner.xTransform.v2Pos, this.v2FlyToPosition) < 15f)
             {
                 this.bPrepareLand = true;
             }
             if (this.iFlyHeightMeister > 0)
             {
                 AnimatedRenderComponent expr_12F7_cp_0 = this.xOwner.xRenderComponent;
                 expr_12F7_cp_0.v2OffsetRenderPos.Y = expr_12F7_cp_0.v2OffsetRenderPos.Y - (float)this.iFlyHeightMeister-- / 8f;
             }
             if (this.bPrepareLand)
             {
                 if (this.enCurrentAction == BirdieAI.BirdieAction.FlyingSpawn)
                 {
                     this.xOwner.xCollisionComponent.ActivateGroup(CollisionComponent.ColliderGroup.Movement);
                 }
                 this.v2RandMoveDir *= 0.92f;
                 if (this.xOwner.xRenderComponent.GetCurrentAnimation().iRenderedFrame == 4)
                 {
                     this.xOwner.xRenderComponent.SwitchAnimation(Convert.ToUInt16(this.xOwner.xRenderComponent.iActiveAnimation + 2), Animation.CancelOptions.IgnoreIfPlaying);
                     this.iFlyHeightMeister = 60;
                     base.SendClientInstruction(6, new float[0]);
                 }
             }
         }
         else if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 12, 13))
         {
             this.v2RandMoveDir = Vector2.Zero;
         }
         else if (Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 16, 17))
         {
             this.v2RandMoveDir *= 0.95f;
             if (this.iFlyHeightMeister > 0)
             {
                 AnimatedRenderComponent expr_142D_cp_0 = this.xOwner.xRenderComponent;
                 expr_142D_cp_0.v2OffsetRenderPos.Y = expr_142D_cp_0.v2OffsetRenderPos.Y + 1f;
                 if (this.xOwner.xRenderComponent.v2OffsetRenderPos.Y >= 0f)
                 {
                     this.xOwner.xRenderComponent.v2OffsetRenderPos.Y = 0f;
                     this.iFlyHeightMeister = 0;
                 }
             }
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.GoingForNormalAttack)
     {
         this.v2HeadMoveDir *= 0.95f;
         if (this.bIsElite)
         {
             this.v2HeadMoveDir *= 0.95f;
         }
     }
     else if (this.enCurrentAction == BirdieAI.BirdieAction.InPeck)
     {
         this.iPeckCountdown--;
         if (this.iPeckCountdown == 0)
         {
             if (this.xPeckAttackPhase != null)
             {
                 this.xPeckAttackPhase.UnregisterCurrent();
             }
             this.xPeckAttackPhase = new AttackPhase(this.xOwner);
             this.xPeckAttackPhase.xTransformOverride = this.xBeakTransform;
             this.xPeckAttackPhase.lenLayers.Add(Collider.ColliderLayers.Players);
             this.xPeckAttackPhase.lenLayers.Add(Collider.ColliderLayers.DynamicEnvironment);
             SphereCollider col = new SphereCollider(11f, Vector2.Zero, this.xBeakTransform, 10000f, this.xOwner);
             this.xPeckAttackPhase.lxCurrentColliders.Add(col);
             col.xAttackPhase = this.xPeckAttackPhase;
             this.xPeckAttackPhase.xStats.iBreakingPower = 5;
             this.xPeckAttackPhase.xStats.fKnockBack = 15f;
             this.xPeckAttackPhase.xStats.iBaseDamage = 15 + this.xOwner.xBaseStats.iBaseATK;
             this.xPeckAttackPhase.xStats.enAttackElement = AttackStats.Element.Neutral;
             this.xPeckAttackPhase.xStats.enAttackType = AttackStats.Type.Physical;
             this.xPeckAttackPhase.xStats.bKnockbackShieldRedistribution = false;
             this.xPeckAttackPhase.RegisterCurrent();
         }
         if (this.v2HeadMoveDir != Vector2.Zero)
         {
             if (Vector2.Distance(this.xRCHead.v2OffsetRenderPos + this.v2HeadMoveDir, this.v2PeckTarget) > Vector2.Distance(this.xRCHead.v2OffsetRenderPos, this.v2PeckTarget))
             {
                 Program.game._EffectMaster_AddEffect(new SortedAnimated(this.xBeakTransform.v2Pos, SortedAnimated.SortedAnimatedEffects._EnemyEffects_Pecko_Peck));
                 Program.game._EffectMaster_AddEffect(new SortedAnimated(this.xBeakTransform.v2Pos, SortedAnimated.SortedAnimatedEffects._EnemyEffects_Pecko_Hole));
                 this.v2HeadMoveDir = Vector2.Zero;
                 if (this.xPeckAttackPhase != null)
                 {
                     this.xPeckAttackPhase.UnregisterCurrent();
                     this.xPeckAttackPhase = null;
                 }
                 if (this.iSubPecks > 0)
                 {
                     this.iSubPecks--;
                 }
                 else
                 {
                     this.enCurrentAction = BirdieAI.BirdieAction.ChillinSoon;
                     this.iNextHardUpdate = 60;
                     base.SendClientInstruction(4, new float[0]);
                     if (this.xRCHead.iActiveAnimation < 100)
                     {
                         this.SwitchHeadAnimation((ushort)(16 + this.xRCHead.GetCurrentAnimation().byAnimationDirection));
                     }
                     this.v2HeadMoveDir = Vector2.Normalize(new Vector2(-this.v2RelaxedHeadOffset.X, this.v2RelaxedHeadOffset.Y) - this.xRCHead.v2OffsetRenderPos) * 6f;
                 }
             }
         }
         else if (!Utility.IsWithinRange((int)this.xOwner.xRenderComponent.iActiveAnimation, 2, 5))
         {
             this.GoPeck();
         }
     }
     if (this.iPrevRegFrame != this.xOwner.xRenderComponent.GetCurrentAnimation().iRenderedFrame)
     {
         this.v2PreviousHeadOffset = this.v2CurrentSourceOffset;
         this.iPrevRegFrame = this.xOwner.xRenderComponent.GetCurrentAnimation().iRenderedFrame;
     }
     this.xOwner.xTransform.v2ServerPos = this.xOwner.xTransform.v2Pos;
 }
Esempio n. 11
0
 public override void OnHitByAttack(AttackCollisionData xAtColData, AttackPhase xAtPhase)
 {
     this.iAgressionCounter += 60;
     this.AddHitEffect();
     base.OnHitByAttack(xAtColData, xAtPhase);
     if (Program.GetTheGame().xNetworkInfo.enCurrentRole != NetworkHelperInterface.NetworkRole.Client)
     {
         if (this.xPlayerLockedOnto != null)
         {
             if (this.iAgressionCounter > 300 && Vector2.Distance(this.xPlayerLockedOnto.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) > 120f && this.FacingTarget())
             {
                 this.v2FlyToPosition = this.xPlayerLockedOnto.xTransform.v2Pos;
                 this.v2FlyToPosition.Y = this.v2FlyToPosition.Y - 20f;
                 if (this.xOwner.byAnimationDirection != 1)
                 {
                     this.xOwner.xRenderComponent.SwitchAnimation(13, Animation.CancelOptions.IgnoreIfPlaying);
                     this.SwitchHeadAnimation(6);
                     this.enCurrentAction = BirdieAI.BirdieAction.Flying;
                     return;
                 }
                 if (this.v2FlyToPosition.X > this.xOwner.xTransform.v2Pos.X)
                 {
                     this.xOwner.xRenderComponent.SwitchAnimation(12, Animation.CancelOptions.IgnoreIfPlaying);
                     this.SwitchHeadAnimation(2);
                     this.enCurrentAction = BirdieAI.BirdieAction.Flying;
                     return;
                 }
             }
         }
         else if (xAtPhase.xOwner.GetTrueOwner().enEntityType == IEntity.EntityType.Player)
         {
             this.xPlayerLockedOnto = (xAtPhase.xOwner.GetTrueOwner() as WorldActor);
         }
     }
 }