protected override void SequenceMainBranch() { switch (SequenceStep) { case 0: User.AnimManager.PlayAnimation(AnimationGlobals.DuplighostBattleAnimations.HeadbuttName); CurSequenceAction = new MoveToSeqAction(User, new Vector2(EntitiesAffected[0].Position.X, EntitiesAffected[0].Position.Y + YHeight), MoveDur); break; case 1: AttemptDamage(Action.DamageProperties.Damage, EntitiesAffected[0], Action.DamageProperties, false); Vector2 pos = BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], User.EntityType == Enumerations.EntityTypes.Player); CurSequenceAction = new MoveToSeqAction(User, pos, MoveDur / 2d, Interpolation.InterpolationTypes.Linear, Interpolation.InterpolationTypes.QuadIn); break; case 2: User.AnimManager.PlayAnimation(AnimationGlobals.IdleName); CurSequenceAction = new WaitSeqAction(WaitDur / 5d); ChangeSequenceBranch(SequenceBranch.End); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: //Go in front of the entity //bool approachFromLeft = User.BattlePosition.X < EntityUsed.BattlePosition.X; Vector2 position = BattleManagerUtils.GetPositionInFront(EntityUsed, false); User.AnimManager.PlayAnimation(AnimationGlobals.RunningName); CurSequenceAction = new MoveToSeqAction(User, position, WalkDur); break; case 1: User.AnimManager.PlayAnimation(AnimationGlobals.GulpitBattleAnimations.SpitRockName); //Show the used entity going inside its mouth; make invisible for now EntityUsed.TintColor = Color.Transparent; EntityUsed.Layer = User.Layer + .0001f; AddSideSeqAction(new MoveToSeqAction(EntityUsed, User.Position + new Vector2(-18, -3), User.AnimManager.GetCurrentAnim <Animation>().CurFrame.Duration)); CurSequenceAction = new WaitForAnimationSeqAction(User, AnimationGlobals.GulpitBattleAnimations.SpitRockName); ChangeSequenceBranch(SequenceBranch.Main); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceMainBranch() { switch (SequenceStep) { case 0: //Always play the standard Idle animation here, since the entity is waiting User.AnimManager.PlayAnimation(AnimationGlobals.IdleName); //Make the used entity fly towards the target EntityUsed.TintColor = PrevUsedTintColor; CurSequenceAction = new MoveToSeqAction(EntityUsed, BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], false), WalkDur / 2d); break; case 1: //When hitting, it should eventually fly off after recoiling if a rock, or if it's like a bomb then explode //There will need to be some type of collision behavior we can define //For now just make it invisible EntityUsed.TintColor = Color.Transparent; //Attempt to deal damage AttemptDamage(BaseDamage, EntitiesAffected[0], Action.DamageProperties, false); ChangeSequenceBranch(SequenceBranch.End); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: Vector2 frontPos = BattleManagerUtils.GetPositionInFront(User.BManager.GetFrontmostBattleEntity(CurTarget.EntityType, null), User.EntityType != EntityTypes.Enemy); frontPos.Y = User.Position.Y; User.AnimManager.PlayAnimation(AnimationGlobals.RunningName); CurSequenceAction = new MoveToSeqAction(User, frontPos, WalkDuration); break; case 1: User.AnimManager.PlayAnimation(AnimationGlobals.JumpStartName); CurSequenceAction = new WaitForAnimationSeqAction(User, AnimationGlobals.JumpStartName); ChangeSequenceBranch(SequenceBranch.Main); //Store the jump distance XDiffOverTwo = UtilityGlobals.DifferenceDivided(CurTarget.Position.X, User.Position.X, 2f); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceMissBranch() { switch (SequenceStep) { case 0: User.AnimManager.PlayAnimation(AnimationGlobals.RunningName); //When Watt misses Electro Dash, she goes in a downwards arc to around where the next enemy slot would be Vector2 destPos = BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], EntitiesAffected[0].EntityType == Enumerations.EntityTypes.Player); Vector2 curDest = User.Position + new Vector2(UtilityGlobals.DifferenceDivided(destPos.X, User.Position.X, 2f), MissHeight); CurSequenceAction = new MoveToSeqAction(User, curDest, MissMoveDur, Interpolation.InterpolationTypes.Linear, Interpolation.InterpolationTypes.QuadOut); break; case 1: destPos = BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], EntitiesAffected[0].EntityType == Enumerations.EntityTypes.Player); curDest = User.Position + new Vector2(UtilityGlobals.DifferenceDivided(destPos.X, User.Position.X, 2f), -MissHeight); CurSequenceAction = new MoveToSeqAction(User, curDest, MissMoveDur, Interpolation.InterpolationTypes.Linear, Interpolation.InterpolationTypes.QuadIn); break; case 2: User.AnimManager.PlayAnimation(AnimationGlobals.IdleName); CurSequenceAction = new WaitSeqAction(MissWaitDur); ChangeSequenceBranch(SequenceBranch.End); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceSuccessBranch() { switch (SequenceStep) { case 0: User.AnimManager.GetAnimation <Animation>(AnimationGlobals.ShelledBattleAnimations.ShellSpinName)?.SetSpeed(3f); Vector2 pos = BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], User.EntityType != Enumerations.EntityTypes.Enemy); CurSequenceAction = new MoveToSeqAction(User, new Vector2(pos.X, User.Position.Y), SpinMoveDuration); break; case 1: InteractionResult[] interactions = AttemptDamage(BaseDamage * DamageMod, EntitiesAffected[0], Action.DamageProperties, false); if (interactions[0] != null && interactions[0].WasVictimHit == true && interactions[0].WasAttackerHit == false) { ShowCommandRankVFX(HighestCommandRank, EntitiesAffected[0].Position); } ChangeSequenceBranch(SequenceBranch.End); break; default: PrintInvalidSequence(); break; } }
protected override void HandleSelectionInput() { if (Input.GetKeyDown(Keys.X)) { OnBackOut(); } else if (Input.GetKeyDown(Keys.Z)) { OnConfirm(); } else if (Input.GetKeyDown(Keys.C)) { //Don't switch if the back player is dead if (CanSwitch() == true) { BattleEntity front = User.BManager.FrontPlayer; BattleEntity back = User.BManager.BackPlayer; //Switch turns with Mario or the Partner //This updates the front and back player battle indices and their battle positions BattleManagerUtils.SwapEntityBattlePosAndIndex(front, back, true); SoundManager.Instance.PlaySound(SoundManager.Sound.SwitchPartner); //Decrement the current entity's turns used and end its turn to start the front entity's turn //This keeps that entity's number of turns the same User.SetTurnsUsed(User.TurnsUsed - 1); User.BManager.TurnEnd(); //Queue a Battle Event to swap the current positions of Mario and his Partner //Since we updated the references earlier, their new positions are their own battle positions User.BManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.Stage, new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn, BattleGlobals.BattleState.TurnEnd }, new SwapPositionBattleEvent(front, back, front.BattlePosition, back.BattlePosition, 500f)); } else { BattleEntity otherPlayer = (User == User.BManager.FrontPlayer) ? User.BManager.BackPlayer : User.BManager.FrontPlayer; if (otherPlayer != null) { Debug.LogError($"{otherPlayer.Name} used all of his/her turns or is dead, so turns cannot be swapped with him/her."); } else { Debug.LogError($"Either Mario or his Partner is null, so there's no one to swap with!"); } } } }
/// <summary> /// The interruption that occurs when jumping on a Spiked entity /// </summary> protected void SpikedEntityInterruption() { switch (SequenceStep) { case 0: User.AnimManager.PlayAnimation(AnimationGlobals.SpikedTipHurtName, true); Vector2 offset = new Vector2(0, -JumpHeight); if (User.EntityType != EntityTypes.Player) { offset.X = -offset.X; } Vector2 pos = BattleManagerUtils.GetPositionInFront(CurTarget, User.EntityType == EntityTypes.Player) + offset; CurSequenceAction = new MoveToSeqAction(User, pos, WalkDuration / 4d); break; case 1: CurSequenceAction = new WaitForAnimationSeqAction(User, AnimationGlobals.SpikedTipHurtName); break; case 2: CurSequenceAction = new MoveAmountSeqAction(User, new Vector2(0f, User.BattlePosition.Y - User.Position.Y), JumpDuration / 2f, Interpolation.InterpolationTypes.Linear, Interpolation.InterpolationTypes.QuadIn); break; case 3: //Do the same bounce as the end sequence, except keep playing the same animation Vector2 endPos = BattleManagerUtils.GetPositionInFront(CurTarget, User.EntityType == EntityTypes.Player); Vector2 moveAmt = new Vector2(UtilityGlobals.DifferenceDivided(endPos.X, User.Position.X, 2f), -(JumpHeight / 2f)); CurSequenceAction = new MoveAmountSeqAction(User, moveAmt, JumpDuration / 2f, Interpolation.InterpolationTypes.Linear, Interpolation.InterpolationTypes.QuadOut); break; case 4: endPos = BattleManagerUtils.GetPositionInFront(CurTarget, User.EntityType == EntityTypes.Player); moveAmt = new Vector2(UtilityGlobals.DifferenceDivided(endPos.X, User.Position.X, 2f), (JumpHeight / 2f)); CurSequenceAction = new MoveAmountSeqAction(User, moveAmt, JumpDuration / 2f, Interpolation.InterpolationTypes.Linear, Interpolation.InterpolationTypes.QuadIn); ChangeSequenceBranch(SequenceBranch.End); SequenceStep = 1; break; default: PrintInvalidSequence(); break; } }
protected override void SequenceMainBranch() { switch (SequenceStep) { case 0: //Wait a bit CurSequenceAction = new WaitSeqAction(300d); break; case 1: //Deal damage InteractionResult[] interactions = AttemptDamage(BaseDamage, EntitiesAffected[0], Action.DamageProperties, false); //Switch only if the victim was hit, damage was greater than 0, and the victim didn't perform any defensive actions if (interactions[0] != null && interactions[0].WasVictimHit == true && interactions[0].VictimResult.TotalDamage > 0 && interactions[0].VictimResult.DefensiveActionsPerformed == Enumerations.DefensiveActionTypes.None) { //Find a Partner to swap to List <BattlePartner> allPartners = new List <BattlePartner>(); Inventory.Instance.partnerInventory.GetAllPartners(allPartners); //Remove the current Partner from being selected allPartners.Remove(User.BManager.Partner); //Filter out all dead Partners BattleManagerUtils.FilterDeadEntities(allPartners); //If there's another Partner available, choose it if (allPartners.Count != 0) { int randIndex = RandomGlobals.Randomizer.Next(0, allPartners.Count); SwapPartnerBattleEvent swapPartnerBattleEvent = new SwapPartnerBattleEvent(User.BManager.Partner, allPartners[randIndex], 300d, 300d); User.BManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.SwapPartner, new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn }, swapPartnerBattleEvent); } } CurSequenceAction = new WaitSeqAction(0d); ChangeSequenceBranch(SequenceBranch.End); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: User.AnimManager.PlayAnimation(AnimationGlobals.WingedBattleAnimations.FlyingName); CurSequenceAction = new MoveToSeqAction(User, new Vector2(BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], User.EntityType != Enumerations.EntityTypes.Enemy).X, User.BattlePosition.Y), 700d); ChangeSequenceBranch(SequenceBranch.Main); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: User.AnimManager.PlayAnimation(AnimationGlobals.RunningName); //Move to the entity CurSequenceAction = new MoveToSeqAction(User, BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], EntitiesAffected[0].EntityType != Enumerations.EntityTypes.Player), WalkDur); ChangeSequenceBranch(SequenceBranch.Main); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: User.AnimManager.PlayAnimation(AnimationGlobals.RunningName); Vector2 pos = BattleManagerUtils.GetPositionInFront(User.BManager.FrontPlayer, User.EntityType != Enumerations.EntityTypes.Player); CurSequenceAction = new MoveToSeqAction(User, pos, WalkDuration / 4f); ChangeSequenceBranch(SequenceBranch.Main); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceMainBranch() { switch (SequenceStep) { case 0: StartActionCommandInput(); Vector2 pos = BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], User.EntityType != Enumerations.EntityTypes.Enemy); pos.Y = User.Position.Y; CurSequenceAction = new MoveToSeqAction(User, pos, WalkDuration); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: User.AnimManager.PlayAnimation(AnimationGlobals.RunningName); CurSequenceAction = new MoveToSeqAction(User, BattleManagerUtils.GetPositionInFront(User, User.EntityType != Enumerations.EntityTypes.Player), WalkDuration); break; case 1: User.AnimManager.PlayAnimation(PickupAnimName, true); CurSequenceAction = new WaitForAnimationSeqAction(User, PickupAnimName); ChangeSequenceBranch(SequenceBranch.Main); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: User.AnimManager.PlayAnimation(AnimationGlobals.RunningName, true); //Get the position in front of the frontmost BattleEntity for this EntityType Vector2 pos = BattleManagerUtils.GetPositionInFront(User.BManager.GetFrontmostBattleEntity(User.EntityType, null), User.EntityType != Enumerations.EntityTypes.Player); pos.Y = User.BattlePosition.Y; CurSequenceAction = new MoveToSeqAction(User, pos, WalkDuration); break; case 1: if (ItemShown != null) { ItemShown.Position = Camera.Instance.SpriteToUIPos(User.GetDrawnPosAbove(new Vector2(0, -20))); User.BManager.battleUIManager.AddUIElement(ItemShown); } User.AnimManager.PlayAnimation(AnimationGlobals.GetItemName, false); CurSequenceAction = new WaitSeqAction(WaitDuration); break; case 2: if (ItemShown != null) { User.BManager.battleUIManager.RemoveUIElement(ItemShown); } User.AnimManager.PlayAnimation(User.GetIdleAnim()); ChangeSequenceBranch(SequenceBranch.Main); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceFailedBranch() { switch (SequenceStep) { case 0: User.AnimManager.GetAnimation <Animation>(AnimationGlobals.ShelledBattleAnimations.ShellSpinName)?.SetSpeed(2f); Vector2 pos = BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], User.EntityType != Enumerations.EntityTypes.Enemy); CurSequenceAction = new MoveToSeqAction(User, new Vector2(pos.X, User.Position.Y), SpinMoveDuration); break; case 1: AttemptDamage(BaseDamage * DamageMod, EntitiesAffected[0], Action.DamageProperties, false); ChangeSequenceBranch(SequenceBranch.End); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceMainBranch() { switch (SequenceStep) { case 0: Vector2 pos = new Vector2(BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], User.EntityType == Enumerations.EntityTypes.Player).X, User.Position.Y); StartActionCommandInput(); CurSequenceAction = new MoveToSeqAction(User, pos, MoveDur); break; case 1: User.AnimManager.PlayAnimation(AnimationGlobals.WattBattleAnimations.WattElectricChargeName); CurSequenceAction = new WaitForCommandSeqAction(500d, actionCommand, CommandEnabled); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceEndBranch() { switch (SequenceStep) { case 0: //Do a little bounce at the end Vector2 endPos = BattleManagerUtils.GetPositionInFront(CurTarget, User.EntityType == EntityTypes.Player); Vector2 moveAmt = new Vector2(UtilityGlobals.DifferenceDivided(endPos.X, User.Position.X, 2f), -(JumpHeight / 2f)); User.AnimManager.PlayAnimation(AnimationGlobals.JumpRisingName); CurSequenceAction = new MoveAmountSeqAction(User, moveAmt, JumpDuration / 2f, Interpolation.InterpolationTypes.Linear, Interpolation.InterpolationTypes.QuadOut); break; case 1: float moveDiffY = User.Position.Y - User.BattlePosition.Y; endPos = BattleManagerUtils.GetPositionInFront(CurTarget, User.EntityType == EntityTypes.Player); moveAmt = new Vector2(UtilityGlobals.DifferenceDivided(endPos.X, User.Position.X, 2f), /*(JumpHeight / 2f)*/ -moveDiffY); User.AnimManager.PlayAnimation(AnimationGlobals.JumpFallingName); CurSequenceAction = new MoveAmountSeqAction(User, moveAmt, JumpDuration / 2f, Interpolation.InterpolationTypes.Linear, Interpolation.InterpolationTypes.QuadIn); break; case 2: User.AnimManager.PlayAnimation(AnimationGlobals.RunningName); CurSequenceAction = new MoveToSeqAction(User, User.BattlePosition, WalkDuration); break; case 3: User.AnimManager.PlayAnimation(User.GetIdleAnim()); EndSequence(); break; default: PrintInvalidSequence(); break; } }
protected override void SequenceStartBranch() { switch (SequenceStep) { case 0: //Move to the opponent CurSequenceAction = new MoveToSeqAction(User, BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], User.EntityType != Enumerations.EntityTypes.Enemy), MoveTime); break; case 1: //Jump up to their height CurSequenceAction = new MoveToSeqAction(User, EntitiesAffected[0].BattlePosition + new Vector2(0f, 10f), JumpTime); break; case 2: //Fall down and latch CurSequenceAction = new MoveAmountSeqAction(User, new Vector2(0f, -10f), JumpTime); break; case 3: //Override defensive actions as the latching shouldn't be guardable DamageData damageData = Action.DamageProperties; damageData.ContactType = Enumerations.ContactTypes.Latch; damageData.Damage = 0; damageData.DefensiveOverride = Enumerations.DefensiveActionTypes.Guard | Enumerations.DefensiveActionTypes.Superguard; //Deal 0 damage //If we go to the Main branch, then we can start the action command //Otherwise an interruption or miss occurred, so handle that in those branches AttemptDamage(0, EntitiesAffected[0], damageData, true); ChangeSequenceBranch(SequenceBranch.Main); break; default: PrintInvalidSequence(); break; } }
protected override void OnStart() { base.OnStart(); //Check if there is a BattleEntity behind the one eaten and if it can be hit by this move List <BattleEntity> behindEntities = new List <BattleEntity>(); User.BManager.GetEntitiesBehind(behindEntities, EntitiesAffected[0]); BattleManagerUtils.FilterEntitiesByHeights(behindEntities, Action.MoveProperties.HeightsAffected); //Store the reference to the behind entity and tell it it's being targeted if (behindEntities.Count > 0) { BehindEntity = behindEntities[0]; BehindEntity.TargetForMove(User); } if (Action.CommandEnabled == true && Action.DrawActionCommandInfo == true) { GulpUI = new GulpActionCommandUI(actionCommand as GulpCommand); User.BManager.battleUIManager.AddUIElement(GulpUI); } }
protected override void SequenceEndBranch() { switch (SequenceStep) { //Go back to your battle position case 0: User.AnimManager.PlayAnimation(AnimationGlobals.WingedBattleAnimations.FlyingName); CurSequenceAction = new MoveToSeqAction(User, new Vector2(BattleManagerUtils.GetPositionInFront(EntitiesAffected[0], User.EntityType != Enumerations.EntityTypes.Enemy).X, User.BattlePosition.Y), 500d); break; case 1: CurSequenceAction = new MoveToSeqAction(User, User.BattlePosition, 400d); break; case 2: User.AnimManager.PlayAnimation(User.GetIdleAnim()); EndSequence(); break; default: PrintInvalidSequence(); break; } }
/// <summary> /// Adds the set of BattleEntities that this move affects into a supplied list. /// <para>This gets the entities based on the MoveAction's <see cref="MoveAffectionTypes"/>.</para> /// </summary> /// <param name="entityList">The list to add the BattleEntities this move affects into.</param> public void GetEntitiesMoveAffects(List <BattleEntity> entityList) { bool addedAllies = false; //Check for adding allies if (UtilityGlobals.MoveAffectionTypesHasFlag(MoveProperties.MoveAffectionType, MoveAffectionTypes.Ally) == true) { entityList.AddRange(User.BManager.GetEntities(User.EntityType, MoveProperties.HeightsAffected)); addedAllies = true; } //Check if the user of the move should be added if (UtilityGlobals.MoveAffectionTypesHasFlag(MoveProperties.MoveAffectionType, MoveAffectionTypes.Self) == true) { //If we didn't add allies, add the user of the move if (addedAllies == false) { entityList.Add(User); } } else { //Otherwise if we're not adding the user of the move and we did add allies, remove the user so we end up with only allies if (addedAllies == true) { entityList.Remove(User); } } //If this move targets other types of BattleEntities, add all of the ones it targets in order if (UtilityGlobals.MoveAffectionTypesHasFlag(MoveProperties.MoveAffectionType, MoveAffectionTypes.Other) == true) { if (MoveProperties.OtherEntTypes != null && MoveProperties.OtherEntTypes.Length > 0) { for (int i = 0; i < MoveProperties.OtherEntTypes.Length; i++) { EntityTypes otherType = MoveProperties.OtherEntTypes[i]; entityList.AddRange(User.BManager.GetEntities(otherType, MoveProperties.HeightsAffected)); } } else { Debug.LogWarning($"{Name} targets {nameof(MoveAffectionTypes.Other)}, but {nameof(MoveProperties.OtherEntTypes)} is null or empty."); } } //If this move has custom entity targeting logic, add the entities to the list if (UtilityGlobals.MoveAffectionTypesHasFlag(MoveProperties.MoveAffectionType, MoveAffectionTypes.Custom) == true) { GetCustomAffectedEntities(entityList); } //Filter out untargetable BattleEntities BattleManagerUtils.FilterEntitiesByTargetable(entityList); //If the BattleEntity has a custom targeting method and shouldn't be targeted, remove it //Otherwise, set to the true target in the event something is defending it for (int i = entityList.Count - 1; i >= 0; i--) { //Check for a custom targeting method bool?targetVal = entityList[i].EntityProperties.CustomTargeting?.Invoke(this); //If it returns false, remove the BattleEntity from the list if (targetVal == false) { entityList.RemoveAt(i); continue; } else { entityList[i] = entityList[i].GetTrueTarget(); } } }