/// <summary> /// Gets the total Danger status value for Mario and his Partner based on their HealthStates. /// This is factored in when calculating the amount of Crystal Star Star Power gained from an attack. /// </summary> /// <returns>A float of the Danger status value based on the HealthStates of both Mario and his Partner.</returns> public static float GetDangerStatusValue(BattleMario mario, BattlePartner partner) { float marioDangerStatusValue = GetMarioDangerStatusValue(mario); float partnerDangerStatusValue = GetPartnerDangerStatusValue(partner); return(marioDangerStatusValue * partnerDangerStatusValue); }
public static void TestSwitchMarioSleep() { BattleMario mario = new BattleMario(new MarioStats(1, 1, 1, 1, 1, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); mario.EntityProperties.AfflictStatus(new SleepStatus(3)); BattleManager manager1 = new BattleManager(); manager1.Initialize(new BattleGlobals.BattleProperties(BattleGlobals.BattleSettings.Normal, true), mario, null, null); Debug.Assert(manager1.TotalEntityCount == 1); Debug.Assert(mario.EntityProperties.HasStatus(Enumerations.StatusTypes.Sleep) == true); BattleManager manager2 = new BattleManager(); manager2.Initialize(new BattleGlobals.BattleProperties(BattleGlobals.BattleSettings.Normal, true), null, null, null); manager1.RemoveEntity(mario, false); Debug.Assert(manager1.TotalEntityCount == 0); Debug.Assert(mario.EntityProperties.HasStatus(Enumerations.StatusTypes.Sleep) == true); manager2.AddEntity(mario, null); Debug.Assert(manager1.TotalEntityCount == 0); Debug.Assert(manager2.TotalEntityCount == 1); Debug.Assert(mario.EntityProperties.HasStatus(Enumerations.StatusTypes.Sleep) == true); mario.EntityProperties.RemoveStatus(Enumerations.StatusTypes.Sleep); Debug.Assert(mario.EntityProperties.HasStatus(Enumerations.StatusTypes.Sleep) == false); manager1.CleanUp(); manager2.CleanUp(); }
public void Draw() { //Vector2 hudPivot = HUDTex.GetCenterOrigin(); SpriteRenderer.Instance.DrawUI(HUDTex, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, false, false, .1f, true); BattleMario mario = BattleManager.Instance.GetMario(); BattlePartner partner = BattleManager.Instance.GetPartner(); if (mario != null) { SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, $"{mario.Name} HP: {mario.CurHP}/{mario.BattleStats.MaxHP}", new Vector2(30, 10), Color.White, .2f); } if (partner != null) { SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, $"{partner.Name} HP: {partner.CurHP}/{partner.BattleStats.MaxHP}", new Vector2(30, 30), Color.White, .2f); } if (mario != null) { SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, $"FP: {mario.CurFP}/{mario.BattleStats.MaxFP}", new Vector2(30, 50), Color.White, .2f); SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, $"SP: {mario.MStats.SSStarPower.SPU}/{mario.MStats.SSStarPower.MaxSPU}", new Vector2(155, 50), Color.White, .2f); } }
public static void NewInteractionUT8() { BattleMario mario = new BattleMario(new MarioStats(1, 5, 50, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goomba goomba = new Goomba(); mario.EntityProperties.AddWeakness(Enumerations.Elements.Normal, new WeaknessHolder(WeaknessTypes.KO, 4)); goomba.EntityProperties.AfflictStatus(new PaybackStatus(5), true); Badge badge = new DoublePainBadge(); goomba.SetHeldCollectible(badge); goomba.OnBattleStart(); InteractionParamHolder param = new InteractionParamHolder(mario, goomba, 4, Enumerations.Elements.Water, false, Enumerations.ContactTypes.TopDirect, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveMoveOverrides.None); InteractionResult oldInteraction = Interactions.GetDamageInteractionOld(param); InteractionResult newInteraction = Interactions.GetDamageInteraction(param); Debug.Log("Old: "); PrintInteractionResult(oldInteraction); Debug.Log("New: "); PrintInteractionResult(newInteraction); badge?.UnEquip(); goomba.SetHeldCollectible(null); }
public static void NewInteractionUT7() { BattleMario mario = new BattleMario(new MarioStats(1, 50, 50, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goomba goomba = new Goomba(); goomba.EntityProperties.AddPhysAttribute(Enumerations.PhysicalAttributes.Fiery); goomba.EntityProperties.AddWeakness(Enumerations.Elements.Ice, new WeaknessHolder(WeaknessTypes.PlusDamage, 2)); Badge badge = new IcePowerBadge(); badge?.Equip(mario); InteractionParamHolder param = new InteractionParamHolder(mario, goomba, 3, Enumerations.Elements.Normal, false, Enumerations.ContactTypes.TopDirect, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveMoveOverrides.None); InteractionResult oldInteraction = Interactions.GetDamageInteractionOld(param); InteractionResult newInteraction = Interactions.GetDamageInteraction(param); Debug.Log("Old: "); PrintInteractionResult(oldInteraction); Debug.Log("New: "); PrintInteractionResult(newInteraction); badge?.UnEquip(); }
public static void TestPartyNPEquipCount() { BattleMario mario = new BattleMario(new MarioStats(0, 0, 0, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goombario goombario = new Goombario(); List <BattleEntity> set = new List <BattleEntity>() { mario, goombario }; CloseCallBadge cc = new CloseCallBadge(); CloseCallPBadge ccp = new CloseCallPBadge(); cc.Equip(mario); ccp.Equip(goombario); Debug.Assert(EntityGlobals.GetCombinedEquippedBadgeCount(set, cc.BadgeType) == 1); Debug.Assert(EntityGlobals.GetCombinedEquippedBadgeCount(set, ccp.BadgeType) == 1); Debug.Assert(EntityGlobals.GetCombinedEquippedNPBadgeCount(set, cc.BadgeType) == 2); Debug.Assert(EntityGlobals.GetCombinedEquippedNPBadgeCount(set, ccp.BadgeType) == 2); Debug.Assert(EntityGlobals.GetCombinedEquippedNPBadgeCount(set, cc.BadgeType) == 2); Debug.Assert(EntityGlobals.GetCombinedEquippedNPBadgeCount(set, ccp.BadgeType) == 2); cc.UnEquip(); ccp.UnEquip(); Debug.Log("\n"); }
public static void PaybackInteractionUT2() { BattleMario mario = new BattleMario(new MarioStats(1, 5, 50, 0, 0, EquipmentGlobals.BootLevels.Super, EquipmentGlobals.HammerLevels.Normal)); KoopaTroopa koopa = new KoopaTroopa(); koopa.RaiseAttack(2); ReturnPostageBadge returnPostage = new ReturnPostageBadge(); ZapTapBadge zapTap = new ZapTapBadge(); returnPostage.Equip(mario); zapTap.Equip(mario); Debug.Assert(mario.EntityProperties.HasPayback()); Debug.Assert(mario.EntityProperties.HasPhysAttributes(true, Enumerations.PhysicalAttributes.Electrified)); int damage = new ShellTossAction(koopa).DamageProperties.Damage + koopa.BattleStats.TotalAttack; InteractionParamHolder paramHolder = new InteractionParamHolder(koopa, mario, damage, Enumerations.Elements.Normal, false, Enumerations.ContactTypes.SideDirect, Enumerations.ContactProperties.Protected, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveActionTypes.None); InteractionResult interaction = Interactions.GetDamageInteraction(paramHolder); PrintInteractionResult(interaction); returnPostage.UnEquip(); zapTap.UnEquip(); Debug.Assert(interaction.VictimResult.TotalDamage == 4); Debug.Assert(interaction.AttackerResult.TotalDamage == 2); }
public static void NewInteractionUT9() { BattleMario mario = new BattleMario(new MarioStats(1, 5, 50, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goomba goomba = new Goomba(); //Update HealthState for Last Stand to kick in on Danger mario.TakeDamage(Enumerations.Elements.Normal, 0, false); Badge badge = new LastStandBadge(); badge?.Equip(mario); InteractionParamHolder param = new InteractionParamHolder(goomba, mario, 80, Enumerations.Elements.Water, false, Enumerations.ContactTypes.TopDirect, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveMoveOverrides.None); InteractionResult oldInteraction = Interactions.GetDamageInteractionOld(param); InteractionResult newInteraction = Interactions.GetDamageInteraction(param); Debug.Log("Old: "); PrintInteractionResult(oldInteraction); Debug.Log("New: "); PrintInteractionResult(newInteraction); badge?.UnEquip(); }
private void InitDefaultBattle(BattleMario mario, List <BattleEntity> entities) { Inventory.Instance.AddItem(new LuckyStar()); Inventory.Instance.AddItem(new Mushroom()); Inventory.Instance.AddItem(new HoneySyrup()); Inventory.Instance.AddItem(new LifeShroom()); Inventory.Instance.AddItem(new Mystery()); Inventory.Instance.AddItem(new ThunderRage()); Inventory.Instance.AddItem(new StoneCap()); Inventory.Instance.AddBadge(new PowerBounceBadge()); Inventory.Instance.AddBadge(new MultibounceBadge()); Inventory.Instance.AddBadge(new PowerSmashBadge()); Inventory.Instance.AddBadge(new DeepFocusBadge()); Inventory.Instance.AddBadge(new DeepFocusBadge()); Inventory.Instance.partnerInventory.AddPartner(new Goompa()); Inventory.Instance.partnerInventory.AddPartner(new Goombario()); Inventory.Instance.partnerInventory.AddPartner(new Kooper()); Inventory.Instance.partnerInventory.AddPartner(new Bow()); Inventory.Instance.partnerInventory.AddPartner(new Watt()); mario.ActivateAndEquipBadge(Inventory.Instance.GetBadge(BadgeGlobals.BadgeTypes.PowerBounce, BadgeGlobals.BadgeFilterType.UnEquipped)); mario.ActivateAndEquipBadge(Inventory.Instance.GetBadge(BadgeGlobals.BadgeTypes.Multibounce, BadgeGlobals.BadgeFilterType.UnEquipped)); mario.ActivateAndEquipBadge(Inventory.Instance.GetBadge(BadgeGlobals.BadgeTypes.PowerSmash, BadgeGlobals.BadgeFilterType.UnEquipped)); mario.ActivateAndEquipBadge(Inventory.Instance.GetBadge(BadgeGlobals.BadgeTypes.DeepFocus, BadgeGlobals.BadgeFilterType.UnEquipped)); mario.ActivateAndEquipBadge(Inventory.Instance.GetBadge(BadgeGlobals.BadgeTypes.DeepFocus, BadgeGlobals.BadgeFilterType.UnEquipped)); entities.Add(new Goomba()); entities.Add(new Paratroopa()); }
/// <summary> /// Initializes the battle /// </summary> /// <param name="mario">Mario</param> /// <param name="partner">Mario's partner</param> /// <param name="enemies">The enemies, in order</param> public void Initialize(BattleMario mario, BattlePartner partner, List <BattleEnemy> enemies) { Mario = mario; Partner = partner; //Mario always starts out in the front, and the Partner always starts out in the back FrontPlayer = Mario; BackPlayer = Partner; Mario.Position = MarioPos; Mario.SetBattlePosition(MarioPos); //Start battle for Mario Mario.OnBattleStart(); if (Partner != null) { Partner.Position = PartnerPos; Partner.SetBattlePosition(PartnerPos); //Start battle for the Partner Partner.OnBattleStart(); } //Add and initialize enemies AddEnemies(enemies); StartBattle(); }
protected override void OnEquip() { //NOTE: Think of a way to make this more flexible to easily add more SpriteSheet swaps with different Badges //Building a system to allow for more combinations would be great as well and add more possibilities //Examples include Partner SpriteSheet swaps (especially Yoshi) BattleMario mario = EntityEquipped as BattleMario; if (mario == null) { Debug.LogWarning($"L Emblem will not work on {EntityEquipped.Name}; it currently works only for Mario"); return; } string sheetPath = $"{ContentGlobals.SpriteRoot}/Characters/Mario"; //Check if W Emblem is equipped and change to Waluigi's clothes if (EntityEquipped.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.WEmblem) > 0) { sheetPath += ContentGlobals.WaluigiPaletteExtension; } //Otherwise change to Luigi's clothes else { sheetPath += ContentGlobals.LuigiPaletteExtension; } EntityEquipped.AnimManager.SetSpriteSheet(AssetManager.Instance.LoadAsset <Texture2D>(sheetPath), ObjAnimManager.SetSpriteSheetOptions.ReplaceSame); }
public static void TestSwitchMarioPeekaboo() { BattleMario mario = new BattleMario(new MarioStats(1, 1, 1, 1, 1, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); KoopaTroopa koopa = new KoopaTroopa(); BattleManager manager1 = new BattleManager(); PeekabooBadge peekaboo = new PeekabooBadge(); peekaboo.Equip(mario); manager1.Initialize(new BattleGlobals.BattleProperties(BattleGlobals.BattleSettings.Normal, true), mario, null, new List <BattleEntity>() { koopa }); Debug.Assert(manager1.TotalEntityCount == 2); Debug.Assert(peekaboo.EntityEquipped == mario); Debug.Assert(peekaboo.EntityEquipped.BManager == manager1); Debug.Assert(koopa.EntityProperties.GetAdditionalProperty <int>(Enumerations.AdditionalProperty.ShowHP) == 1); BattleManager manager2 = new BattleManager(); Goomba goomba = new Goomba(); manager2.Initialize(new BattleGlobals.BattleProperties(BattleGlobals.BattleSettings.Normal, true), null, null, new List <BattleEntity>() { goomba }); Debug.Assert(manager2.TotalEntityCount == 1); Debug.Assert(goomba.EntityProperties.GetAdditionalProperty <int>(Enumerations.AdditionalProperty.ShowHP) == 0); manager1.RemoveEntity(mario, false); Debug.Assert(manager1.TotalEntityCount == 1); Debug.Assert(peekaboo.EntityEquipped == mario); Debug.Assert(koopa.EntityProperties.GetAdditionalProperty <int>(Enumerations.AdditionalProperty.ShowHP) == 0); manager2.AddEntity(mario, null); Debug.Assert(manager2.TotalEntityCount == 2); Debug.Assert(peekaboo.EntityEquipped == mario); Debug.Assert(peekaboo.EntityEquipped.BManager == manager2); Debug.Assert(koopa.EntityProperties.GetAdditionalProperty <int>(Enumerations.AdditionalProperty.ShowHP) == 0); Debug.Assert(goomba.EntityProperties.GetAdditionalProperty <int>(Enumerations.AdditionalProperty.ShowHP) == 1); peekaboo.UnEquip(); manager1.CleanUp(); manager2.CleanUp(); }
public static void NewInteractionUT2() { BattleMario mario = new BattleMario(new MarioStats(1, 50, 50, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); SpikedGoomba spikedGoomba = new SpikedGoomba(); InteractionParamHolder param = new InteractionParamHolder(mario, spikedGoomba, 5, Enumerations.Elements.Normal, false, Enumerations.ContactTypes.TopDirect, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveMoveOverrides.None); InteractionResult oldInteraction = Interactions.GetDamageInteractionOld(param); InteractionResult newInteraction = Interactions.GetDamageInteraction(param); Debug.Log("Old: "); PrintInteractionResult(oldInteraction); Debug.Log("New: "); PrintInteractionResult(newInteraction); }
public static void PaybackInteractionUT3() { BattleMario mario = new BattleMario(new MarioStats(1, 5, 50, 0, 0, EquipmentGlobals.BootLevels.Super, EquipmentGlobals.HammerLevels.Normal)); Pokey pokey = new Pokey(); Debug.Assert(pokey.EntityProperties.HasPhysAttributes(true, Enumerations.PhysicalAttributes.Spiked)); Debug.Assert(pokey.EntityProperties.HasPayback()); InteractionParamHolder paramHolder = new InteractionParamHolder(mario, pokey, 3, Enumerations.Elements.Normal, false, Enumerations.ContactTypes.SideDirect, Enumerations.ContactProperties.None, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveActionTypes.None); InteractionResult interaction = Interactions.GetDamageInteraction(paramHolder); PrintInteractionResult(interaction); Debug.Assert(interaction.VictimResult.DontDamageEntity == true); Debug.Assert(interaction.AttackerResult.IsPaybackDamage == true); }
public static void NewInteractionUT5() { BattleMario mario = new BattleMario(new MarioStats(1, 50, 50, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goomba goomba = new Goomba(); goomba.EntityProperties.AddPhysAttribute(Enumerations.PhysicalAttributes.Electrified); goomba.EntityProperties.AddPayback(new StatusGlobals.PaybackHolder(StatusGlobals.PaybackTypes.Half, Enumerations.Elements.Poison, new StatusChanceHolder(100d, new PoisonStatus(5)))); InteractionParamHolder param = new InteractionParamHolder(mario, goomba, 10, Enumerations.Elements.Normal, false, Enumerations.ContactTypes.TopDirect, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveMoveOverrides.None); InteractionResult oldInteraction = Interactions.GetDamageInteractionOld(param); InteractionResult newInteraction = Interactions.GetDamageInteraction(param); Debug.Log("Old: "); PrintInteractionResult(oldInteraction); Debug.Log("New: "); PrintInteractionResult(newInteraction); }
protected override void OnUnequip() { BattleMario mario = EntityEquipped as BattleMario; //Don't do anything, as the badge made no changes when equipped if (mario == null) { return; } string sheetPath = $"{ContentGlobals.SpriteRoot}/Characters/Mario"; //Check if W Emblem is equipped and change to Wario's clothes if (EntityEquipped.GetEquippedBadgeCount(BadgeGlobals.BadgeTypes.WEmblem) > 0) { sheetPath += ContentGlobals.WarioPaletteExtension; } EntityEquipped.AnimManager.SetSpriteSheet(AssetManager.Instance.LoadAsset <Texture2D>(sheetPath), ObjAnimManager.SetSpriteSheetOptions.ReplaceSame); }
public static void PaybackInteractionUT1() { BattleMario mario = new BattleMario(new MarioStats(1, 5, 50, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goomba goomba = new Goomba(); mario.EntityProperties.AfflictStatus(new HoldFastStatus(3)); Debug.Assert(mario.EntityProperties.HasPayback()); InteractionParamHolder paramHolder = new InteractionParamHolder(goomba, mario, 0, Enumerations.Elements.Normal, true, Enumerations.ContactTypes.Latch, Enumerations.ContactProperties.None, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveActionTypes.Guard | Enumerations.DefensiveActionTypes.Superguard); InteractionResult interaction = Interactions.GetDamageInteraction(paramHolder); PrintInteractionResult(interaction); Debug.Assert(interaction.AttackerResult.TotalDamage == 1); Debug.Assert(interaction.VictimResult.TotalDamage == 0); }
public static void NewInteractionUT6() { BattleMario mario = new BattleMario(new MarioStats(1, 50, 50, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goomba goomba = new Goomba(); mario.EntityProperties.AddPayback(new StatusGlobals.PaybackHolder(StatusGlobals.PaybackTypes.Full, Enumerations.Elements.Star)); goomba.EntityProperties.AddPhysAttribute(Enumerations.PhysicalAttributes.Electrified); goomba.EntityProperties.AddPayback(new StatusGlobals.PaybackHolder(StatusGlobals.PaybackTypes.Half, Enumerations.Elements.Poison, new StatusChanceHolder(100d, new PoisonStatus(5)))); Badge dd1 = new DamageDodgeBadge(); dd1?.Equip(mario); Badge dd2 = new DamageDodgeBadge(); dd2?.Equip(mario); //For defensive actions; add flags in their code to make them always succeed //We'll need to implement the debug badge that automatically completes action commands as well as //make it easier to start input for action commands for debugging mario.OnTurnEnd(); mario.Update(); InteractionParamHolder param = new InteractionParamHolder(goomba, mario, 10, Enumerations.Elements.Normal, false, Enumerations.ContactTypes.TopDirect, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveMoveOverrides.None); InteractionResult oldInteraction = Interactions.GetDamageInteractionOld(param); InteractionResult newInteraction = Interactions.GetDamageInteraction(param); Debug.Log("Old: "); PrintInteractionResult(oldInteraction); Debug.Log("New: "); PrintInteractionResult(newInteraction); if (BattleManager.Instance.EntityTurn.PreviousAction?.MoveSequence.InSequence == false) { BattleManager.Instance.EntityTurn.OnTurnStart(); } dd1?.UnEquip(); dd2?.UnEquip(); }
public void Draw() { if (BManager == null) { return; } BattleMario mario = BManager.Mario; BattlePartner partner = BManager.Partner; if (mario != null) { SpriteRenderer.Instance.DrawUI(HPBanner.Tex, new Vector2(60, 50), HPBanner.SourceRect, Color.White, 0f, Vector2.Zero, 1f, false, false, .1f, true); SpriteRenderer.Instance.DrawUI(MarioHPIcon.Tex, new Vector2(50, 40), MarioHPIcon.SourceRect, Color.White, 0f, Vector2.Zero, 1f, false, false, .11f, true); SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, $"{mario.CurHP}/{mario.BattleStats.MaxHP}", new Vector2(120, 54), Color.White, .2f); } if (partner != null) { SpriteRenderer.Instance.DrawUI(HPBanner.Tex, new Vector2(60, 90), HPBanner.SourceRect, Color.White, 0f, Vector2.Zero, 1f, false, false, .1f, true); SpriteRenderer.Instance.DrawUI(PartnerHPIcon.Tex, new Vector2(50, 85), PartnerHPIcon.SourceRect, Color.White, 0f, Vector2.Zero, .7f, false, false, .11f, true); SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, $"{partner.CurHP}/{partner.BattleStats.MaxHP}", new Vector2(120, 94), Color.White, .2f); } if (mario != null) { //Draw FP info SpriteRenderer.Instance.DrawUI(FPBanner.Tex, new Vector2(250, 50), FPBanner.SourceRect, Color.White, 0f, Vector2.Zero, 1f, false, false, .1f, true); SpriteRenderer.Instance.DrawUI(FPIcon.Tex, new Vector2(240, 45), FPIcon.SourceRect, Color.White, 0f, Vector2.Zero, 1f, false, false, .11f, true); SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, $"{mario.CurFP}/{mario.BattleStats.MaxFP}", new Vector2(305, 53), Color.White, .2f); //Draw Star Power info SpriteRenderer.Instance.DrawUI(StarPowerBanner.Tex, new Vector2(250, 90), StarPowerBanner.SourceRect, Color.White, 0f, Vector2.Zero, 1f, false, false, .1f, true); SpriteRenderer.Instance.DrawUI(StarPowerIcon.Tex, new Vector2(240, 85), StarPowerIcon.SourceRect, Color.White, 0f, Vector2.Zero, 1f, false, false, .11f, true); SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, $"{mario.MStats.SSStarPower.SPU}/{mario.MStats.SSStarPower.MaxSPU}", new Vector2(305, 93), Color.White, .2f); } }
public static void NewInteractionUT10() { BattleMario mario = new BattleMario(new MarioStats(1, 5, 50, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goomba goomba = new Goomba(); mario.EntityProperties.AddResistance(Enumerations.Elements.Electric, new ResistanceHolder(ResistanceTypes.Heal, 0)); goomba.EntityProperties.AddPayback(new StatusGlobals.PaybackHolder(StatusGlobals.PaybackTypes.Half, Enumerations.Elements.Electric)); goomba.EntityProperties.AfflictStatus(new ElectrifiedStatus(5), true); InteractionParamHolder param = new InteractionParamHolder(mario, goomba, 90, Enumerations.Elements.Normal, false, Enumerations.ContactTypes.TopDirect, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveMoveOverrides.None); InteractionResult oldInteraction = Interactions.GetDamageInteractionOld(param); InteractionResult newInteraction = Interactions.GetDamageInteraction(param); Debug.Log("Old: "); PrintInteractionResult(oldInteraction); Debug.Log("New: "); PrintInteractionResult(newInteraction); }
public static void TestBothEquipCount() { BattleMario mario = new BattleMario(new MarioStats(0, 0, 0, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goombario goombario = new Goombario(); List <BattleEntity> set = new List <BattleEntity>() { mario, goombario }; QuickChangeBadge qc = new QuickChangeBadge(); TimingTutorBadge tt = new TimingTutorBadge(); qc.Equip(mario); tt.Equip(goombario); Debug.Assert(mario.GetEquippedBadgeCount(qc.BadgeType) != goombario.GetEquippedBadgeCount(qc.BadgeType)); Debug.Assert(mario.GetEquippedBadgeCount(tt.BadgeType) != goombario.GetEquippedBadgeCount(tt.BadgeType)); Debug.Assert(EntityGlobals.GetCombinedEquippedBadgeCount(set, qc.BadgeType) == 1); Debug.Assert(EntityGlobals.GetCombinedEquippedBadgeCount(set, tt.BadgeType) == 1); qc.UnEquip(); tt.UnEquip(); Debug.Log("\n"); qc.Equip(goombario); tt.Equip(mario); Debug.Assert(mario.GetEquippedBadgeCount(qc.BadgeType) != goombario.GetEquippedBadgeCount(qc.BadgeType)); Debug.Assert(mario.GetEquippedBadgeCount(tt.BadgeType) != goombario.GetEquippedBadgeCount(tt.BadgeType)); Debug.Assert(EntityGlobals.GetCombinedEquippedBadgeCount(set, qc.BadgeType) == 1); Debug.Assert(EntityGlobals.GetCombinedEquippedBadgeCount(set, tt.BadgeType) == 1); qc.UnEquip(); tt.UnEquip(); Debug.Log("\n"); }
public static void TestSwitchMarioLuckyStart() { BattleMario mario = new BattleMario(new MarioStats(1, 1, 1, 1, 1, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); BattleManager manager1 = new BattleManager(); manager1.Initialize(new BattleGlobals.BattleProperties(BattleGlobals.BattleSettings.Normal, true), mario, null, null); LuckyStartBadge luckyStart = new LuckyStartBadge(); luckyStart.Equip(mario); Debug.Assert(manager1.TotalEntityCount == 1); Debug.Assert(luckyStart.EntityEquipped == mario); Debug.Assert(luckyStart.EntityEquipped.BManager == manager1); BattleManager manager2 = new BattleManager(); manager2.Initialize(new BattleGlobals.BattleProperties(BattleGlobals.BattleSettings.Normal, true), null, null, null); Debug.Assert(manager2.TotalEntityCount == 0); manager1.RemoveEntity(mario, false); Debug.Assert(manager1.TotalEntityCount == 0); Debug.Assert(luckyStart.EntityEquipped == mario); manager2.AddEntity(mario, null); Debug.Assert(manager2.TotalEntityCount == 1); Debug.Assert(luckyStart.EntityEquipped == mario); Debug.Assert(luckyStart.EntityEquipped.BManager == manager2); luckyStart.UnEquip(); manager1.CleanUp(); manager2.CleanUp(); }
public static void ElementOverrideInteractionUT1() { BattleMario mario = new BattleMario(new MarioStats(1, 5, 50, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); Goomba goomba = new Goomba(); IcePowerBadge icePower = new IcePowerBadge(); icePower.Equip(mario); IcePowerBadge icePower2 = new IcePowerBadge(); icePower2.Equip(mario); goomba.EntityProperties.AddPhysAttribute(Enumerations.PhysicalAttributes.Fiery); goomba.EntityProperties.AddWeakness(Enumerations.Elements.Ice, new WeaknessHolder(WeaknessTypes.PlusDamage, 1)); Debug.Assert(goomba.EntityProperties.HasPhysAttributes(true, Enumerations.PhysicalAttributes.Fiery)); Debug.Assert(goomba.EntityProperties.HasWeakness(Enumerations.Elements.Ice)); ElementOverrideHolder overrideHolder = mario.EntityProperties.GetTotalElementOverride(goomba); Debug.Assert(overrideHolder.Element == Enumerations.Elements.Ice); Debug.Assert(overrideHolder.OverrideCount == 2); InteractionParamHolder param = new InteractionParamHolder(mario, goomba, 1, Enumerations.Elements.Ice, true, Enumerations.ContactTypes.TopDirect, null, Enumerations.DamageEffects.None, false, Enumerations.DefensiveMoveOverrides.None); InteractionResult interaction = Interactions.GetDamageInteraction(param); Debug.Assert(interaction.VictimResult.TotalDamage == 4); PrintInteractionResult(interaction); icePower.UnEquip(); icePower2.UnEquip(); ElementOverrideHolder overrideHolder2 = mario.EntityProperties.GetTotalElementOverride(goomba); Debug.Assert(overrideHolder2.Element == Enumerations.Elements.Invalid); }
/// <summary> /// Gets Mario's Danger status value based on his current HealthState. /// </summary> /// <param name="partner">Mario.</param> /// <returns>A float of Mario's Danger status value.</returns> private static float GetMarioDangerStatusValue(BattleMario mario) { if (mario == null) { Debug.LogError($"{nameof(mario)} is null, which should never happen"); return(NormalMod); } Enumerations.HealthStates marioHealthState = mario.HealthState; switch (marioHealthState) { case Enumerations.HealthStates.Normal: return(NormalMod); case Enumerations.HealthStates.Danger: return(MarioDangerMod); case Enumerations.HealthStates.Peril: case Enumerations.HealthStates.Dead: default: return(MarioPerilMod); } }
/// <summary> /// Partners and Mario add to Mario's FP pool. /// </summary> /// <param name="fp"></param> public override void HealFP(int fp) { BattleMario mario = BManager.Mario; mario.HealFP(fp); }
public override void LowerMaxFP(int fp) { BattleMario mario = BManager.Mario; mario.LowerMaxFP(fp); }
private void LoadBattle() { //Initialize core battle properties BattleGlobals.BattleProperties battleProperties = new BattleGlobals.BattleProperties(BattleGlobals.BattleSettings.Normal, true); BattleMario mario = new BattleMario(new MarioStats(1, 10, 5, 0, 0, EquipmentGlobals.BootLevels.Normal, EquipmentGlobals.HammerLevels.Normal)); List <BattleEntity> enemyList = new List <BattleEntity>(); //Clean up any previous references we may have lightingManager?.CleanUp(); lightingManager = null; battleManager?.CleanUp(); battleManager = null; if (Inventory.HasInstance == true) { Inventory.Instance.CleanUp(); } if (DialogueManager.HasInstance == true) { DialogueManager.Instance.CleanUp(); } //Read from the config //First check if the config is in the same folder as the executable if (ConfigLoader.LoadConfig($"{ContentGlobals.ConfigName}", ref battleProperties, mario, enemyList) == false) { //If it's not here, check in the root of the Content folder if (ConfigLoader.LoadConfig($"{ContentGlobals.ContentRoot}/{ContentGlobals.ConfigName}", ref battleProperties, mario, enemyList) == false) { //If we failed to read from the config, initialize a default battle InitDefaultBattle(mario, enemyList); } } //Initialize the BattleManager battleManager = new BattleManager(); //Send out the first Partner to battle, provided it exists int partnerCount = Inventory.Instance.partnerInventory.GetPartnerCount(); BattlePartner partner = (partnerCount == 0) ? null : Inventory.Instance.partnerInventory.GetAllPartners()[0]; battleManager.Initialize(battleProperties, mario, partner, enemyList); //Initialize helper objects //Check for the battle setting and add darkness if so if (battleManager.Properties.BattleSetting == BattleGlobals.BattleSettings.Dark) { BattleDarknessObj battleDarkness = new BattleDarknessObj(battleManager); //Initialize the lighting manager for dark battles lightingManager = new LightingManager(battleDarkness, AssetManager.Instance.LoadAsset <Effect>($"{ContentGlobals.ShaderRoot}Lighting"), AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.ShaderTextureRoot}LightMask.png")); battleManager.battleObjManager.AddBattleObject(battleDarkness); } //Add the HP bar manager battleManager.battleObjManager.AddBattleObject(new HPBarManagerObj(battleManager)); //If you can't run from battle, show a message at the start saying so if (battleManager.Properties.Runnable == false) { battleManager.battleEventManager.QueueBattleEvent((int)BattleGlobals.BattleEventPriorities.Message, new BattleGlobals.BattleState[] { BattleGlobals.BattleState.Turn }, new MessageBattleEvent(battleManager.battleUIManager, BattleGlobals.NoRunMessage, MessageBattleEvent.DefaultWaitDuration)); } //Start the battle battleManager.StartBattle(); }
public override void LowerMaxFP(int fp) { BattleMario mario = BattleManager.Instance.GetMario(); mario.LowerMaxFP(fp); }
/// <summary> /// Partners and Mario add to Mario's FP pool. /// </summary> /// <param name="fp"></param> public override void HealFP(int fp) { BattleMario mario = BattleManager.Instance.GetMario(); mario.HealFP(fp); }
public override void RaiseMaxFP(int fp) { BattleMario mario = BManager.Mario; mario.RaiseMaxFP(fp); }