public override void OnEnteredBattle() { base.OnEnteredBattle(); //Add the Balloon to the current battle BManager.AddEntity(Balloon, null); Balloon.Position = Position + new Vector2(2, -40); Balloon.SetBattlePosition(Balloon.Position); }
public override void OnPhaseEnd() { base.OnPhaseEnd(); //Create Mini-Yuxes when the phase ends (they do this before Bobbery Bombs go in the actual games) //If the Yux is immobile or dead, don't do anything if (IsDead == true || this.IsImmobile() == true) { return; } const double moveTime = 800d; //Set these destinations for all existing Mini-Yuxes //If any are created, we need to do the following: /* 1. Show them moving into the Yux * 2. Show them, along with the new Mini-Yuxes, moving into their nwe positions, coming out of the Yux */ Vector2[] posArray = null; BattleEntity[] existingMinis = null; if (NumMiniYuxes > 0 && NumMiniYuxes < MaxMiniYuxes) { //Set positions for all existing Mini-Yuxes to move into the Yux existingMinis = MiniYuxes.ToArray(); posArray = new Vector2[existingMinis.Length]; for (int i = 0; i < existingMinis.Length; i++) { posArray[i] = Position; } } //Tell if we created any Mini-Yuxes so we can rearrange their formation if so bool createdAny = false; //Create Mini-Yuxes for (int i = 0; i < MiniYuxesPerTurn; i++) { //Stop if we have the max number of Mini-Yuxes if (NumMiniYuxes >= MaxMiniYuxes) { break; } //Create a new Mini-Yux MiniYux miniYux = new MiniYux(); //Mark it as a Helper, telling that it helps the Yux miniYux.EntityProperties.AddAdditionalProperty(AdditionalProperty.HelperEntity, this); //Handle when the Mini-Yux takes damage //If it dies, we want to remove it from the list miniYux.DamageTakenEvent -= OnMiniYuxDamageTaken; miniYux.DamageTakenEvent += OnMiniYuxDamageTaken; //Set position to the center of the Yux miniYux.Position = Position; //Add the Mini-Yux to the Yux's list MiniYuxes.Add(miniYux); //Add the Mini-Yux to battle with the same BattleIndex as the Yux BManager.AddEntity(miniYux, BattleIndex); createdAny = true; } //If we created any Mini-Yuxes, set the formation and add the shield if necessary if (createdAny == true) { //Add the shield if the Yux doesn't have it if (HasShield == false) { AddRemoveShield(true); } //Queue a battle event to rearrange with after-images //This first battle event moves the previous set of Mini-Yuxes, before the additional ones were created, into the Yux //If we didn't have any Mini-Yuxes, don't do anything if (existingMinis != null) { BManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.YuxArrange + 1, new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn, BattleGlobals.BattleState.TurnEnd }, new MoveWithAfterImagesBattleEvent(existingMinis, posArray, moveTime, new AfterImageVFX(null, 4, 3, .5f, AfterImageVFX.AfterImageAlphaSetting.Constant, AfterImageVFX.AfterImageAnimSetting.Current), Interpolation.InterpolationTypes.QuadInOut, Interpolation.InterpolationTypes.QuadInOut)); } //Get the end position array set up for arranging all Mini-Yuxes into their new positions Vector2[] battlePosArray = new Vector2[MiniYuxes.Count]; //Get the formation Vector2[] formation = GetMiniFormation(NumMiniYuxes); for (int i = 0; i < MiniYuxes.Count; i++) { //Set each Mini-Yux's new battle position Vector2 battlePosition = BattlePosition + formation[i]; MiniYuxes[i].SetBattlePosition(battlePosition); battlePosArray[i] = battlePosition; } //Re-sort the enemy list since their positions have changed BManager.SortEntityList(EntityType); //Queue a lower-priority battle event for the Mini-Yuxes to go to their battle positions after the initial event is done //Include after-images here as well BManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.YuxArrange, new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn, BattleGlobals.BattleState.TurnEnd }, new MoveWithAfterImagesBattleEvent(MiniYuxes.ToArray(), battlePosArray, moveTime, new AfterImageVFX(null, 4, 3, .5f, AfterImageVFX.AfterImageAlphaSetting.Constant, AfterImageVFX.AfterImageAnimSetting.Current), Interpolation.InterpolationTypes.QuadInOut, Interpolation.InterpolationTypes.QuadInOut)); } }