private void InterruptAll() { this.StopBeamSound(); if (this.xShieldedEnemy != null) { this.xShieldedEnemy.xBaseStats.bUltimateGuard = false; } if (this.xShieldEffect != null) { (this.xShieldEffect.xRenderComponent as AnimatedRenderComponent).SwitchAnimation(2, Animation.CancelOptions.IgnoreIfPlaying); } if (this.xSlowThingy != null) { this.xSlowThingy.Disable(); } if (this.xSparkMos != null) { this.xSparkMos.bToBeDestroyed = true; } if (this.xConnectedBeamCrystal != null) { CrystalAI xOther = this.xConnectedBeamCrystal; this.xConnectedBeamCrystal = null; bool bIsTarget = false; foreach (Enemy x in Program.GetTheGame().dixEnemyList.Values) { if (x.enType == EnemyCodex.EnemyTypes.Guardian) { CrystalAI xAI = x.xBehaviour as CrystalAI; if (xAI.enCrystalColor == CrystalAI.CrystalColor.Green && xAI.xConnectedBeamCrystal == xOther) { bIsTarget = true; break; } } } if (!bIsTarget) { xOther.SourceBeamShutDown(); } } }
public void StartBeam(CrystalAI xOtherCrystal) { if (this.enCurrentAction == CrystalAI.CrystalAction.BeamFiring) { this.enCurrentAction = CrystalAI.CrystalAction.ChooseColor; return; } this.xConnectedBeamCrystal = xOtherCrystal; this.iNextHardUpdate = 0; this.enCurrentAction = CrystalAI.CrystalAction.BeamStartup; if (this.enCurrentAction != CrystalAI.CrystalAction.BeamFiring) { xOtherCrystal.enCurrentAction = CrystalAI.CrystalAction.ReceivingBeam; } this.xOwner.xRenderComponent.SwitchAnimation(1, Animation.CancelOptions.IgnoreIfPlaying); xOtherCrystal.xOwner.xRenderComponent.SwitchAnimation(1, Animation.CancelOptions.IgnoreIfPlaying); xOtherCrystal.bIsTargetedByCrystal = true; xOtherCrystal.v2RandMoveDir = Utility.RandomizeVector2Direction(Program.GetTheGame().randomInLogic); }
public override void OnClientUpdate() { if (!this.bInited) { byte byMos = this.byClientReadByte; ushort iID = this.iClientReadUshort; if (byMos == 0) { if (Program.GetTheGame().dixEnemyList.ContainsKey(iID)) { this.xConnectedBeamCrystal = (Program.GetTheGame().dixEnemyList[iID].xBehaviour as CrystalAI); this.enCurrentAction = CrystalAI.CrystalAction.BeamFiring; this.iNextHardUpdate = 400; this.xSparkMos = (Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(new Vector2(-100f, -100f), SortedAnimated.SortedAnimatedEffects.FatSpark)) as SortedAnimated); this.xSparkMos.xRenderComponent.fVirtualHeight += 20f; this.iBeamCounter = 0; this.xBeamEffect = (Program.GetTheGame()._EffectMaster_AddEffect(new Effect_Beam(this.xOwner, this.xConnectedBeamCrystal.xOwner, this.xOwner.xRenderComponent.fVirtualHeight, -27f, "Sprites/Monster/Temple/Crystal/Beam/")) as Effect_Beam); this.SetFastMode(true); } } else if (byMos == 1 && Program.GetTheGame().dixEnemyList.ContainsKey(iID)) { this.xShieldedEnemy = Program.GetTheGame().dixEnemyList[iID]; this.xShieldEffect = (Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(Vector2.Zero, SortedAnimated.SortedAnimatedEffects._EnemyEffects_Crystal_ShieldEffect)) as SortedAnimated); this.xShieldEffect.xRenderComponent.fVirtualHeight += this.xShieldedEnemy.xRenderComponent.fVirtualHeight; this.xShieldEffect.xRenderComponent.xTransform = this.xShieldedEnemy.xTransform; } this.bInited = true; } if (this.enCurrentAction == CrystalAI.CrystalAction.BeamFiring && this.xConnectedBeamCrystal != null) { Vector2 v2DirBetween = Vector2.Normalize(this.xConnectedBeamCrystal.xOwner.xTransform.v2Pos - this.xOwner.xTransform.v2Pos); this.Crystal_CreateEffectOnLines(this.xConnectedBeamCrystal.xOwner.xTransform.v2Pos - v2DirBetween * 3f); if (this.iBeamCounter != 6) { this.iBeamCounter++; } if (this.iBeamCounter == 12) { this.enCurrentAction = CrystalAI.CrystalAction.Chillin; if (this.xSparkMos != null) { this.xSparkMos.bToBeDestroyed = true; this.xSparkMos = null; } return; } int arg_25F_0 = this.iBeamCounter; } }
public override void OnUpdate() { if (this.xOwner.bToBeDestroyed || this.bGonnaDie) { return; } Random knark = Program.GetTheGame().randomInLogic; if (!this.bInited) { List<WorldActor> lx = Program.game._Enemy_GetTargetList(this, true); bool bFound = false; foreach (WorldActor x in lx) { if (Vector2.Distance(x.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) < 400f) { bFound = true; break; } } if (!bFound) { return; } this.bInited = true; } this.iCounter++; this.iNextHardUpdate--; if (this.enCurrentAction == CrystalAI.CrystalAction.ChooseColor) { if (this.iCounter >= 100 - Program.GetTheGame()._Enemy_GetDifficultyModifier() * 10) { int iMos = knark.Next(10); List<Enemy> lxEnemies = Program.GetTheGame().GetEnemiesOfType(EnemyCodex.EnemyTypes.Guardian); if (iMos <= 4) { if (lxEnemies.Count > 1) { lxEnemies.ShuffleList<Enemy>(); foreach (Enemy x2 in lxEnemies) { if (Vector2.Distance(x2.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) < (float)(400 + 40 * Program.GetTheGame()._Enemy_GetDifficultyModifier())) { CrystalAI xAI = x2.xBehaviour as CrystalAI; if (xAI.enCurrentAction == CrystalAI.CrystalAction.Chillin || xAI.enCurrentAction == CrystalAI.CrystalAction.ChooseColor) { xAI.ChangeColors(1); this.ChangeColors(1); iMos = 11; break; } } } } iMos += 5; } if (iMos < 7) { this.ChangeColors(2); } else if (iMos < 10) { this.ChangeColors(0); } this.iCounter = 0; } } else if (this.enCurrentAction == CrystalAI.CrystalAction.Chillin) { if (this.enCrystalColor == CrystalAI.CrystalColor.Blue) { if (this.iCounter % 60 == 0) { List<Enemy> lxEnemies2 = Program.GetTheGame()._Enemies_GetEnemiesByDistanceToHitbox(this.xOwner.xTransform.v2Pos, (float)(400 + 40 * Program.GetTheGame()._Enemy_GetDifficultyModifier()), false); lxEnemies2.ShuffleList<Enemy>(); foreach (Enemy x3 in lxEnemies2) { if (x3 != this.xOwner && !x3.bToBeDestroyed && x3.xBaseStats.iHP > 0 && !this.ShieldedByAnotherCrystal(x3) && !Program.GetTheGame()._CollisionMaster_RayCastVsStatic(this.xOwner.xTransform.v2Pos + Vector2.Normalize(x3.xTransform.v2Pos - this.xOwner.xTransform.v2Pos) * 15f, x3.xTransform.v2Pos, 5f, 3, this.xOwner.xCollisionComponent.ibitCurrentColliderLayer)) { if (x3.enType == EnemyCodex.EnemyTypes.Guardian) { CrystalAI xAI2 = x3.xBehaviour as CrystalAI; if (xAI2.enCrystalColor == CrystalAI.CrystalColor.Blue) { continue; } } this.xShieldedEnemy = x3; this.enCurrentAction = CrystalAI.CrystalAction.Shield_Startup; this.xOwner.xRenderComponent.SwitchAnimation(101, Animation.CancelOptions.IgnoreIfPlaying); break; } } if (this.xShieldedEnemy == null) { this.enCurrentAction = CrystalAI.CrystalAction.ChooseColor; } } } else if (this.enCrystalColor == CrystalAI.CrystalColor.Purple) { if (this.iCounter == 60) { Rectangle rec = Program.GetTheGame().xLevelMaster.xCurrentLevel.FindCurrentBattleBox(this.xOwner.xTransform.v2Pos); if (CAS.GameMode == StateMaster.GameModes.RogueLike) { rec = new Rectangle(0, 0, 100000, 100000); } if (rec == Rectangle.Empty) { this.enCurrentAction = CrystalAI.CrystalAction.ChooseColor; this.iCounter = 0; } else { List<WorldActor> xActor = Program.GetTheGame()._Enemy_GetTargetList(this, true); bool bFoundOne = false; Vector2 v2LolPoint = Vector2.Zero; foreach (WorldActor x4 in xActor) { if (rec.Contains(Utility.Vector2ToPoint(x4.xTransform.v2Pos)) && Vector2.Distance(x4.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) < 115f) { bFoundOne = true; v2LolPoint = x4.xTransform.v2Pos; break; } } if (bFoundOne) { v2LolPoint.X = MathHelper.Clamp(v2LolPoint.X, (float)(rec.Left + 40), (float)(rec.Right - 40)); v2LolPoint.Y = MathHelper.Clamp(v2LolPoint.Y, (float)(rec.Top + 40), (float)(rec.Bottom - 40)); this.CreateSlow(v2LolPoint); } else { this.iCounter = 30; } } } } else if (this.enCrystalColor == CrystalAI.CrystalColor.Green && this.iNextHardUpdate <= 0) { this.iNextHardUpdate = 60; foreach (Enemy x5 in Program.GetTheGame().dixEnemyList.Values) { if (x5 != this.xOwner && !x5.bToBeDestroyed && x5.xBaseStats.iHP > 0 && x5.enType == EnemyCodex.EnemyTypes.Guardian && Vector2.Distance(x5.xTransform.v2Pos, this.xOwner.xTransform.v2Pos) < (float)(400 + 40 * Program.GetTheGame()._Enemy_GetDifficultyModifier())) { CrystalAI xAI3 = x5.xBehaviour as CrystalAI; if (xAI3.enCrystalColor == CrystalAI.CrystalColor.Green && xAI3.enCurrentAction != CrystalAI.CrystalAction.BeamFiring) { this.StartBeam(xAI3); break; } } } if (this.enCurrentAction != CrystalAI.CrystalAction.BeamStartup && knark.Next(2) == 0) { this.enCurrentAction = CrystalAI.CrystalAction.ChooseColor; this.iCounter = 0; } } } else if (this.enCurrentAction == CrystalAI.CrystalAction.ColorChange_Blue || this.enCurrentAction == CrystalAI.CrystalAction.ColorChange_Green || this.enCurrentAction == CrystalAI.CrystalAction.ColorChange_Purple) { if (this.iNextHardUpdate == 8) { if (this.enCurrentAction == CrystalAI.CrystalAction.ColorChange_Blue) { this.xOwner.xRenderComponent.SwitchAnimation(100, Animation.CancelOptions.IgnoreIfPlaying); } else if (this.enCurrentAction == CrystalAI.CrystalAction.ColorChange_Purple) { this.xOwner.xRenderComponent.SwitchAnimation(200, Animation.CancelOptions.IgnoreIfPlaying); } else if (this.enCurrentAction == CrystalAI.CrystalAction.ColorChange_Green) { this.xOwner.xRenderComponent.SwitchAnimation(0, Animation.CancelOptions.IgnoreIfPlaying); } } else if (this.iNextHardUpdate <= 0) { if (this.enCurrentAction == CrystalAI.CrystalAction.ColorChange_Blue) { this.enCrystalColor = CrystalAI.CrystalColor.Blue; } else if (this.enCurrentAction == CrystalAI.CrystalAction.ColorChange_Purple) { this.enCrystalColor = CrystalAI.CrystalColor.Purple; } else if (this.enCurrentAction == CrystalAI.CrystalAction.ColorChange_Green) { this.enCrystalColor = CrystalAI.CrystalColor.Green; } this.enCurrentAction = CrystalAI.CrystalAction.Chillin; } } else if (this.enCurrentAction == CrystalAI.CrystalAction.Slow_Startup) { if (this.xSlowThingy == null) { this.enCurrentAction = CrystalAI.CrystalAction.Chillin; this.xOwner.xRenderComponent.SwitchAnimation(200, Animation.CancelOptions.IgnoreIfPlaying); } else { this.iSlowCounter++; if (this.xSlowThingy.xRenderComponent.iActiveAnimation == 1) { this.enCurrentAction = CrystalAI.CrystalAction.Slow_Active; this.xSlowThingy.bActivated = true; } } } else if (this.enCurrentAction == CrystalAI.CrystalAction.Slow_Active) { this.iSlowCounter++; if (this.xSlowThingy != null && this.iSlowCounter >= 400) { this.enCurrentAction = CrystalAI.CrystalAction.ChooseColor; this.xOwner.xRenderComponent.SwitchAnimation(203, Animation.CancelOptions.IgnoreIfPlaying); this.iCounter = 0; this.xSlowThingy.Disable(); this.xSlowThingy = null; } int iBreakPoint = 120; if (CAS.DifficultySetting > 0) { iBreakPoint = 50; } if (this.iCounter % 170 == iBreakPoint) { this.v2RandMoveDir = Utility.RandomizeVector2Direction(knark); } if (this.iCounter % 170 > iBreakPoint) { this.xOwner.xTransform.v2Pos += this.v2RandMoveDir * this.xOwner.xBaseStats.fMovementSpeed; } } else if (this.enCurrentAction != CrystalAI.CrystalAction.Shield_Startup) { if (this.enCurrentAction == CrystalAI.CrystalAction.Shield_Active) { int iBreakPoint2 = 120; if (CAS.DifficultySetting > 0) { iBreakPoint2 = 50; } if (this.iCounter % 180 == iBreakPoint2) { this.v2RandMoveDir = Utility.RandomizeVector2Direction(knark); } if (this.iCounter % 180 > iBreakPoint2) { this.xOwner.xTransform.v2Pos += this.v2RandMoveDir * this.xOwner.xBaseStats.fMovementSpeed; } } else if (this.enCurrentAction == CrystalAI.CrystalAction.BeamStartup) { if (this.xConnectedBeamCrystal == null || this.xConnectedBeamCrystal.bGonnaDie) { this.enCurrentAction = CrystalAI.CrystalAction.Chillin; this.xConnectedBeamCrystal = null; } else if (this.xOwner.xRenderComponent.iActiveAnimation != 2 && this.xOwner.xRenderComponent.iActiveAnimation != 1) { this.xConnectedBeamCrystal = null; } } else { if (this.enCurrentAction == CrystalAI.CrystalAction.BeamFiring) { if (this.xConnectedBeamCrystal == null) { this.enCurrentAction = CrystalAI.CrystalAction.ChooseColor; this.iCounter = 0; this.xOwner.xRenderComponent.SwitchAnimation(0, Animation.CancelOptions.IgnoreIfPlaying); this.SetFastMode(false); if (this.xSparkMos != null) { this.xSparkMos.bToBeDestroyed = true; this.xSparkMos = null; } if (this.xBeamEffect != null) { this.xBeamEffect.Fade(); base.SendClientInstruction(3, new float[0]); } this.StopBeamSound(); return; } if (this.xConnectedBeamCrystal.xOwner.bToBeDestroyed) { this.enCurrentAction = CrystalAI.CrystalAction.Chillin; this.xOwner.xRenderComponent.SwitchAnimation(0, Animation.CancelOptions.IgnoreIfPlaying); this.xConnectedBeamCrystal = null; base.SendClientInstruction(3, new float[0]); this.SetFastMode(false); this.StopBeamSound(); if (this.xSparkMos != null) { this.xSparkMos.bToBeDestroyed = true; this.xSparkMos = null; } if (this.xBeamEffect != null) { this.xBeamEffect.Fade(); base.SendClientInstruction(3, new float[0]); } return; } if (this.iBeamCounter <= 6 && this.iCounter >= 240 + 30 * Program.GetTheGame()._Enemy_GetDifficultyModifier()) { this.iBeamCounter = 7; base.SendClientInstruction(4, new float[0]); } this.xOwner.xTransform.v2Pos += this.v2RandMoveDir * this.xOwner.xBaseStats.fMovementSpeed; Vector2 v2DirBetween = Vector2.Normalize(this.xConnectedBeamCrystal.xOwner.xTransform.v2Pos - this.xOwner.xTransform.v2Pos); this.Crystal_CreateEffectOnLines(this.xConnectedBeamCrystal.xOwner.xTransform.v2Pos - v2DirBetween * 3f); if (this.iBeamCounter != 6) { this.iBeamCounter++; } if (this.iBeamCounter == 12) { this.enCurrentAction = CrystalAI.CrystalAction.ChooseColor; this.iCounter = 0; this.xOwner.xRenderComponent.SwitchAnimation(0, Animation.CancelOptions.IgnoreIfPlaying); if (this.xConnectedBeamCrystal != null) { CrystalAI xOther = this.xConnectedBeamCrystal; this.xConnectedBeamCrystal = null; xOther.SourceBeamShutDown(); } this.SetFastMode(false); if (this.xSparkMos != null) { this.xSparkMos.bToBeDestroyed = true; this.xSparkMos = null; } if (this.xBeamEffect != null) { this.xBeamEffect.Fade(); base.SendClientInstruction(3, new float[0]); } this.StopBeamSound(); return; } int arg_BBD_0 = this.iBeamCounter; if (this.dxiNPCHitByBeam.Count > 0) { List<NPC> xL = new List<NPC>(); foreach (NPC x6 in this.dxiNPCHitByBeam.Keys) { xL.Add(x6); } for (int i = 0; i < xL.Count; i++) { this.dxiNPCHitByBeam[xL[i]] = this.dxiNPCHitByBeam[xL[i]] - 1; if (this.dxiNPCHitByBeam[xL[i]] == 0) { this.dxiNPCHitByBeam.Remove(xL[i]); } } } List<WorldActor> lxa = Program.GetTheGame()._Enemy_GetTargetList(this, true); using (List<WorldActor>.Enumerator enumerator7 = lxa.GetEnumerator()) { while (enumerator7.MoveNext()) { WorldActor x7 = enumerator7.Current; Vector2 v2Dir = Vector2.Normalize(x7.xTransform.v2Pos - this.xOwner.xTransform.v2Pos); float fDistance = Vector2.Distance(v2Dir, v2DirBetween); fDistance = Utility.DistanceFromPointToLineSegment(x7.xTransform.v2Pos, this.xOwner.xTransform.v2Pos, this.xConnectedBeamCrystal.xOwner.xTransform.v2Pos); if (fDistance < 4f) { if (x7.enEntityType == IEntity.EntityType.Player) { PlayerEntity xPlayer = x7 as PlayerEntity; if (xPlayer.iPostHitInvincibility <= 0) { Program.GetTheGame()._Player_TakeDamage(xPlayer.Owner, 30 + CAS.DifficultyModifier * 5, 0); } } else if (x7.enEntityType == IEntity.EntityType.NPC) { NPC xNPC = x7 as NPC; if (!this.dxiNPCHitByBeam.ContainsKey(xNPC)) { Program.GetTheGame()._NPC_TakeDamage(xNPC, 30 + CAS.DifficultyModifier * 5, 0, new AttackPhase(this.xOwner)); this.dxiNPCHitByBeam[xNPC] = 20; } } } } goto IL_E35; } } if (this.enCurrentAction == CrystalAI.CrystalAction.ReceivingBeam) { LocalInputHelper arg_DD9_0 = Program.GetTheGame().xInput_Game; int arg_DE3_0 = this.iCounter; if (GameSessionData.iBaseDifficulty > 0 && this.xOwner.xRenderComponent.iActiveAnimation == 2) { this.xOwner.xTransform.v2Pos += this.v2RandMoveDir * this.xOwner.xBaseStats.fMovementSpeed; } } } } IL_E35: this.xOwner.xTransform.v2ServerPos = this.xOwner.xTransform.v2Pos; }
public override void InstructionsFromServer(byte byInstructionID, params float[] afParams) { if (byInstructionID == 0) { ushort iID = (ushort)afParams[0]; if (Program.GetTheGame().dixEnemyList.ContainsKey(iID)) { this.xShieldedEnemy = Program.GetTheGame().dixEnemyList[iID]; this.xShieldEffect = (Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(Vector2.Zero, SortedAnimated.SortedAnimatedEffects._EnemyEffects_Crystal_ShieldEffect)) as SortedAnimated); this.xShieldEffect.xRenderComponent.fVirtualHeight += this.xShieldedEnemy.xRenderComponent.fVirtualHeight; this.xShieldEffect.xRenderComponent.xTransform = this.xShieldedEnemy.xTransform; return; } } else { if (byInstructionID == 1) { this.xColorChangeEffect = (Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(Vector2.Zero, SortedAnimated.SortedAnimatedEffects._EnemyEffects_Crystal_ChangeColor)) as SortedAnimated); this.xColorChangeEffect.xRenderComponent.fVirtualHeight = this.xOwner.xRenderComponent.fVirtualHeight + 1f; this.xColorChangeEffect.xRenderComponent.xTransform = this.xOwner.xTransform; return; } if (byInstructionID == 2) { ushort iID2 = (ushort)afParams[0]; if (Program.GetTheGame().dixEnemyList.ContainsKey(iID2)) { this.xConnectedBeamCrystal = (Program.GetTheGame().dixEnemyList[iID2].xBehaviour as CrystalAI); this.enCurrentAction = CrystalAI.CrystalAction.BeamFiring; this.iNextHardUpdate = 400; this.xSparkMos = (Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(new Vector2(-100f, -100f), SortedAnimated.SortedAnimatedEffects.FatSpark)) as SortedAnimated); this.xSparkMos.xRenderComponent.fVirtualHeight += 20f; this.iBeamCounter = 0; this.xBeamEffect = (Program.GetTheGame()._EffectMaster_AddEffect(new Effect_Beam(this.xOwner, this.xConnectedBeamCrystal.xOwner, this.xOwner.xRenderComponent.fVirtualHeight, -27f, "Sprites/Monster/Temple/Crystal/Beam/")) as Effect_Beam); this.StartBeamSound(); this.xConnectedBeamCrystal.StartBeamSound(); return; } } else { if (byInstructionID == 3) { this.enCurrentAction = CrystalAI.CrystalAction.Chillin; if (this.xSparkMos != null) { this.xSparkMos.bToBeDestroyed = true; } if (this.xBeamEffect != null) { this.xBeamEffect.Fade(); } this.StopBeamSound(); return; } if (byInstructionID == 4) { this.iBeamCounter = 7; return; } if (byInstructionID == 10) { this.SetFastMode(true); return; } if (byInstructionID == 11) { this.SetFastMode(false); } } } }