private BaseAutomaticSkill CreateDummySkill(BaseSkillRequirement Requirement) { BaseAutomaticSkill TestSkill = new BaseAutomaticSkill(); TestSkill.CurrentLevel = 1; TestSkill.Name = "Test"; BaseSkillLevel TestSkillLevel = new BaseSkillLevel(); BaseSkillActivation TestSkillActivation = new BaseSkillActivation(); TestSkillActivation.ListEffectTarget.Add(new List <string>() { "Self" }); TestSkillActivation.ListEffectTargetReal.Add(new List <AutomaticSkillTargetType>() { DummyMap.DicAutomaticSkillTarget[EffectActivationSelf.Name].Copy() }); TestSkillActivation.ActivationPercentage = 100; TestSkillActivation.ListRequirement.Add(Requirement); FinalDamageEffect NewEffect = (FinalDamageEffect)DummyMap.DicEffect[FinalDamageEffect.Name].Copy(); NewEffect.FinalDamageValue = "100"; NewEffect.NumberType = Core.Operators.NumberTypes.Absolute; NewEffect.LifetimeType = SkillEffect.LifetimeTypePermanent; TestSkillActivation.ListEffect.Add(NewEffect); TestSkillLevel.ListActivation.Add(TestSkillActivation); TestSkill.ListSkillLevel.Add(TestSkillLevel); return(TestSkill); }
public void PlayerPhaseStartRequirementSuccess() { PlayerPhaseStartRequirement NewRequirement = (PlayerPhaseStartRequirement)DummyMap.DicRequirement[PlayerPhaseStartRequirement.Name].Copy(); FinalDamageEffect NewEffect = (FinalDamageEffect)DummyMap.DicEffect[FinalDamageEffect.Name].Copy(); NewEffect.FinalDamageValue = "1000"; BaseAutomaticSkill DummySkill = CreateDummySkill(NewRequirement, DummyMap.DicAutomaticSkillTarget[EffectActivationSelf.Name].Copy(), NewEffect); Squad DummySquad = CreateDummySquad(); GlobalDeathmatchContext.SetContext(DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummyMap.ActiveParser); GlobalDeathmatchContext.EffectOwnerUnit.Pilot.ArrayPilotSkill = new BaseAutomaticSkill[1] { DummySkill }; DummySkill.AddSkillEffectsToTarget(PlayerPhaseStartRequirement.Name); List <BaseEffect> ListActiveEffect = GlobalDeathmatchContext.EffectOwnerUnit.Pilot.Effects.GetActiveEffects("Dummy"); Assert.AreEqual(1, ListActiveEffect.Count); }
public void TestManaReserveUsage() { AttackContext.Owner = CreateDummyRobot(); MagicUser ActiveUser = new MagicUser(); MagicSpell ActiveSpell = new MagicSpell(ActiveUser, ActiveUser); MagicUserParams Params = new MagicUserParams(ActiveSpell.GlobalContext); ActiveUser.ManaReserves = 1000; ActiveUser.CurrentMana = 100; InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams); FireballCore1.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params)); ActiveSpell.ListMagicCore.Add(FireballCore1); ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser); BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0]; for (int i = 0; i < 10; i++) { NewSkill.AddSkillEffectsToTarget(string.Empty); } Assert.AreEqual(0, ActiveUser.ChanneledMana); Assert.AreEqual(990, ActiveUser.ManaReserves); Assert.AreEqual(100, ActiveUser.CurrentMana); }
public void GivenBeforeGettingMissedRequirement_WhenActivatedDuringABattle_ThenFinalDamageChanged() { Squad DummySquad = CreateDummySquad(); Squad DummyDefenderSquad = CreateDummySquad(); Unit DummyUnit = DummySquad.CurrentLeader; Unit DummyDefenderUnit = DummyDefenderSquad.CurrentLeader; DummyUnit.Pilot.ArrayLevelHIT[0] = 0; DummyUnit.Pilot.Init(); DummyDefenderUnit.Pilot.ArrayLevelEVA[0] = 200; DummyDefenderUnit.Pilot.Init(); Assert.AreEqual(0, DummyMap.CalculateHitRate(DummyUnit, DummySquad, DummyDefenderUnit, DummyDefenderSquad, Unit.BattleDefenseChoices.Defend)); BaseAutomaticSkill TestSkill = CreateDummySkill(new BeforeGettingMissedRequirement(GlobalDeathmatchContext)); DummyDefenderSquad.CurrentLeader.Pilot.ArrayPilotSkill = new BaseAutomaticSkill[1] { TestSkill }; var Result = DummyMap.CalculateFinalHP(DummySquad, null, 0, BattleMap.FormationChoices.Focused, DummyDefenderSquad, null, 1, 0, true, false); var ResultCounter = DummyMap.CalculateFinalHP(DummyDefenderSquad, null, 0, BattleMap.FormationChoices.Focused, DummySquad, null, 1, 0, true, false); Assert.AreEqual(0, Result.ArrayResult[0].AttackDamage); Assert.AreEqual(true, Result.ArrayResult[0].AttackMissed); Assert.AreEqual(11980, ResultCounter.ArrayResult[0].AttackDamage); }
public void WillReachedRequirementFail() { WillReachedRequirement NewRequirement = (WillReachedRequirement)DummyMap.DicRequirement[WillReachedRequirement.Name].Copy(); NewRequirement.Will = "90"; NewRequirement.LogicOperator = Core.Operators.LogicOperators.GreaterOrEqual; FinalDamageEffect NewEffect = (FinalDamageEffect)DummyMap.DicEffect[FinalDamageEffect.Name].Copy(); NewEffect.FinalDamageValue = "1000"; BaseAutomaticSkill DummySkill = CreateDummySkill(NewRequirement, DummyMap.DicAutomaticSkillTarget[EffectActivationSelf.Name].Copy(), NewEffect); Squad DummySquad = CreateDummySquad(); GlobalDeathmatchContext.SetContext(DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummyMap.ActiveParser); GlobalDeathmatchContext.EffectOwnerUnit.Pilot.Will = 50; DummySkill.AddSkillEffectsToTarget(string.Empty); List <BaseEffect> ListActiveEffect = GlobalDeathmatchContext.EffectOwnerUnit.Pilot.Effects.GetActiveEffects("Dummy"); Assert.AreEqual(0, ListActiveEffect.Count); }
public void TestFireballChannelingActivation() { AttackContext.Owner = CreateDummyRobot(); MagicUser ActiveUser = new MagicUser(); MagicSpell ActiveSpell = new MagicSpell(ActiveUser, ActiveUser); MagicUserParams Params = new MagicUserParams(ActiveSpell.GlobalContext); ActiveUser.ManaReserves = 1000; ActiveUser.CurrentMana = 100; InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams); FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params)); ActiveSpell.ListMagicCore.Add(FireballCore1); ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser); BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0]; CreateFireballEffectTripleThunder Fireball = (CreateFireballEffectTripleThunder)NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0]; for (int i = 0; i < 9; i++) { NewSkill.AddSkillEffectsToTarget(string.Empty); Assert.AreEqual(i + 1, Fireball.ChanneledMana); } NewSkill.AddSkillEffectsToTarget(string.Empty); Assert.AreEqual(1, ((InvisibleMagicCoreFireball)ActiveSpell.ListMagicCore[0]).NumberOfExecutions); Assert.AreEqual(0, ActiveUser.ChanneledMana); Assert.AreEqual(100, ActiveUser.CurrentMana); }
private void InitSkillChainTarget(BaseAutomaticSkill ActiveSkill) { foreach (BaseSkillLevel ActiveSkillLevel in ActiveSkill.ListSkillLevel) { foreach (BaseSkillActivation ActiveSkillActivation in ActiveSkillLevel.ListActivation) { for (int E = 0; E < ActiveSkillActivation.ListEffect.Count; ++E) { if (ActiveSkillActivation.ListEffect[E] is TripleThunderAttackEffect) { ActiveSkillActivation.ListEffectTargetReal[E].Add(AutomaticSkillTargetType.DicTargetType["Self Attack"]); } else if (ActiveSkillActivation.ListEffect[E] is TripleThunderRobotEffect) { ActiveSkillActivation.ListEffectTargetReal[E].Add(AutomaticSkillTargetType.DicTargetType["Self Robot"]); } else if (ActiveSkillActivation.ListEffect[E] is ProjectileEffect) { ActiveSkillActivation.ListEffectTargetReal[E].Add(AutomaticSkillTargetType.DicTargetType["Self Attack"]); } foreach (BaseAutomaticSkill ActiveFollowingSkill in ActiveSkillActivation.ListEffect[E].ListFollowingSkill) { InitSkillChainTarget(ActiveFollowingSkill); } } } } }
public void PilotStatRequirementHITSuccess() { PilotStatRequirement NewRequirement = (PilotStatRequirement)DummyMap.DicRequirement[PilotStatRequirement.Name].Copy(); NewRequirement.StatusType = StatusTypes.HIT; NewRequirement.LogicOperator = Core.Operators.LogicOperators.GreaterOrEqual; NewRequirement.EffectValue = "50"; FinalDamageEffect NewEffect = (FinalDamageEffect)DummyMap.DicEffect[FinalDamageEffect.Name].Copy(); NewEffect.FinalDamageValue = "1000"; BaseAutomaticSkill DummySkill = CreateDummySkill(NewRequirement, DummyMap.DicAutomaticSkillTarget[EffectActivationSelf.Name].Copy(), NewEffect); Squad DummySquad = CreateDummySquad(); GlobalDeathmatchContext.SetContext(DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummyMap.ActiveParser); DummySkill.AddSkillEffectsToTarget(string.Empty); List <BaseEffect> ListActiveEffect = GlobalDeathmatchContext.EffectOwnerUnit.Pilot.Effects.GetActiveEffects("Dummy"); Assert.AreEqual(1, ListActiveEffect.Count); }
public void TestPostAttackEffect() { PostAttackEffect NewEffect = (PostAttackEffect)DummyMap.DicEffect[PostAttackEffect.Name].Copy(); NewEffect.Attack = true; NewEffect.Transform = true; NewEffect.Spirit = true; NewEffect.Move = true; BaseAutomaticSkill DummySkill = CreateDummySkill(DummyMap.DicRequirement[PassiveRequirement.Name].Copy(), DummyMap.DicAutomaticSkillTarget[EffectActivationSelf.Name].Copy(), NewEffect); Squad DummySquad = CreateDummySquad(); GlobalDeathmatchContext.SetContext(DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, null); Assert.IsFalse(GlobalDeathmatchContext.EffectOwnerUnit.Boosts.PostAttackModifier.Attack); Assert.IsFalse(GlobalDeathmatchContext.EffectOwnerUnit.Boosts.PostAttackModifier.Transform); Assert.IsFalse(GlobalDeathmatchContext.EffectOwnerUnit.Boosts.PostAttackModifier.Spirit); Assert.IsFalse(GlobalDeathmatchContext.EffectOwnerUnit.Boosts.PostAttackModifier.Move); DummySkill.AddSkillEffectsToTarget(string.Empty); Assert.IsTrue(GlobalDeathmatchContext.EffectOwnerUnit.Boosts.PostAttackModifier.Attack); Assert.IsTrue(GlobalDeathmatchContext.EffectOwnerUnit.Boosts.PostAttackModifier.Transform); Assert.IsTrue(GlobalDeathmatchContext.EffectOwnerUnit.Boosts.PostAttackModifier.Spirit); Assert.IsTrue(GlobalDeathmatchContext.EffectOwnerUnit.Boosts.PostAttackModifier.Move); }
public UnitStandardPart(string SkillPath, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect, Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget) { Skill = new BaseAutomaticSkill(); Skill.Name = Path.GetFileNameWithoutExtension(SkillPath); Skill.CurrentLevel = 1; Skill.ListSkillLevel = new List <BaseSkillLevel>(); FileStream FS = new FileStream(SkillPath, FileMode.Open, FileAccess.Read); BinaryReader BR = new BinaryReader(FS, Encoding.UTF8); Skill.Description = BR.ReadString(); BaseSkillLevel NewSkillLevel = new BaseSkillLevel(); Skill.ListSkillLevel.Add(NewSkillLevel); NewSkillLevel.ActivationsCount = BR.ReadInt32(); int ListActivationRequirementCount = BR.ReadInt32(); for (int R = 0; R < ListActivationRequirementCount; R++) { NewSkillLevel.ListActivation.Add(new BaseSkillActivation(BR, DicRequirement, DicEffect, DicAutomaticSkillTarget)); } FS.Close(); BR.Close(); }
/// <summary> /// Load a SkillChain at selected path. /// </summary> /// <param name="PartPath">Path from which to open the Combo.</param> private void LoadSkillChain(string SkillChainPath) { AllowEvent = false; string Name = SkillChainPath.Substring(0, SkillChainPath.Length - 5).Substring(36); this.Text = Name + " - Project Eternity Triple Thunder Skill Chain Editor"; FileStream FS = new FileStream("Content/Triple Thunder/Skill Chains/" + Name + ".pesc", FileMode.Open, FileAccess.Read); BinaryReader BR = new BinaryReader(FS, Encoding.UTF8); BR.BaseStream.Seek(0, SeekOrigin.Begin); int tvSkillsNodesCount = BR.ReadInt32(); for (int N = 0; N < tvSkillsNodesCount; ++N) { BaseAutomaticSkill ActiveSkill = new BaseAutomaticSkill(BR, DicRequirement, DicEffect, DicAutomaticSkillTarget); CreateTree(ActiveSkill, tvSkills.Nodes); } BR.Close(); FS.Close(); AllowEvent = true; }
private void tsmNewEffect_Click(object sender, EventArgs e) { TreeNode SelectedNode = tvSkills.SelectedNode; if (SelectedNode != null) { TreeNode ParentNode = null; if (SelectedNode.Tag is BaseAutomaticSkill) { ParentNode = SelectedNode; } else { ParentNode = SelectedNode.Parent; } BaseEffect NewEffect = DicEffect.First().Value.Copy(); BaseAutomaticSkill ActiveSkill = (BaseAutomaticSkill)ParentNode.Tag; ActiveSkill.ListSkillLevel[0].ListActivation[0].ListEffect.Add(NewEffect); ActiveSkill.ListSkillLevel[0].ListActivation[0].ListEffectTarget.Add(new List <string>()); TreeNode EffectNode = new TreeNode(NewEffect.EffectTypeName); ParentNode.Nodes.Insert(ActiveSkill.ListSkillLevel[0].ListActivation[0].ListEffect.Count - 1, EffectNode); } }
private void tvSkills_AfterSelect(object sender, TreeViewEventArgs e) { AllowEvent = false; TreeNode SelectedNode = e.Node; if (SelectedNode.Tag is BaseAutomaticSkill) { SelectSkill((BaseAutomaticSkill)SelectedNode.Tag); } else { BaseAutomaticSkill ActiveSkill = SelectedNode.Tag as BaseAutomaticSkill; while (ActiveSkill == null) { SelectedNode = SelectedNode.Parent; ActiveSkill = SelectedNode.Tag as BaseAutomaticSkill; } SelectSkill(ActiveSkill); lstEffects.SelectedIndex = e.Node.Parent.Nodes.IndexOf(e.Node); } AllowEvent = true; }
public void ActivateAutomaticSkills(Squad ActiveSquad, Unit ActiveUnit, string SkillRequirementToActivate, Squad TargetSquad = null, Unit TargetUnit = null) { Character TargetPilot; if (TargetUnit != null) { TargetPilot = TargetUnit.Pilot; } else { TargetPilot = null; } GlobalBattleContext.SetContext(ActiveSquad, ActiveUnit, null, TargetSquad, TargetUnit, TargetPilot); // Character Skills for (int C = 0; C < ActiveUnit.ArrayCharacterActive.Length; C++) { GlobalBattleContext.SetContext(ActiveSquad, ActiveUnit, ActiveUnit.ArrayCharacterActive[C], TargetSquad, TargetUnit, TargetPilot); for (int S = 0; S < ActiveUnit.ArrayCharacterActive[C].ArrayPilotSkill.Length; S++) { BaseAutomaticSkill ActiveSkill = ActiveUnit.ArrayCharacterActive[C].ArrayPilotSkill[S]; ActiveSkill.AddSkillEffectsToTarget(SkillRequirementToActivate); } for (int S = 0; S < ActiveUnit.ArrayCharacterActive[C].ArrayRelationshipBonus.Length; S++) { BaseAutomaticSkill ActiveSkill = ActiveUnit.ArrayCharacterActive[C].ArrayRelationshipBonus[S]; ActiveSkill.AddSkillEffectsToTarget(SkillRequirementToActivate); } } GlobalBattleContext.SetContext(ActiveSquad, ActiveUnit, ActiveUnit.Pilot, TargetSquad, TargetUnit, TargetPilot); // Unit Abilities for (int S = 0; S < ActiveUnit.ArrayUnitAbility.Length; S++) { BaseAutomaticSkill ActiveSkill = ActiveUnit.ArrayUnitAbility[S]; ActiveSkill.AddSkillEffectsToTarget(SkillRequirementToActivate); } // Attack Attributes if (ActiveUnit.CurrentAttack != null) { for (int S = 0; S < ActiveUnit.CurrentAttack.ArrayAttackAttributes.Length; S++) { BaseAutomaticSkill ActiveSkill = ActiveUnit.CurrentAttack.ArrayAttackAttributes[S]; ActiveSkill.AddSkillEffectsToTarget(SkillRequirementToActivate); } } //Reset active effects in case an effect was removed. ActiveUnit.ExecuteSkillsEffects(); GlobalBattleContext.SetContext(null, null, null, TargetSquad, TargetUnit, TargetPilot); }
public void TestExplodingFireballPositionWithOffset() { AttackContext.Owner = CreateDummyRobot(); MagicUser ActiveUser = new MagicUser(); MagicSpell ActiveSpell = new MagicSpell(ActiveUser, ActiveUser); MagicUserParams Params = new MagicUserParams(ActiveSpell.GlobalContext); ActiveUser.ManaReserves = 1000; ActiveUser.CurrentMana = 100; InvisibleMagicCoreFireball FireballCore1 = new InvisibleMagicCoreFireball(Params, AttackParams); FireballCore1.ListLinkedMagicElement.Add(new ChannelExternalManaSource(Params)); FireballCore1.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5)); InvisibleMagicCoreFireball FireballCore2 = new InvisibleMagicCoreFireball(Params, AttackParams); FireballCore2.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params)); FireballCore2.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5)); FireballCore2.ListLinkedMagicElement.Add(new MagicCoreOffset(Params, AttackParams, -15, 0)); InvisibleMagicCoreFireball FireballCore3 = new InvisibleMagicCoreFireball(Params, AttackParams); FireballCore3.ListLinkedMagicElement.Add(new ChannelInternalManaSource(Params)); FireballCore3.ListLinkedMagicElement.Add(new TriggerAfterTimeEllapsed(Params, 5)); FireballCore3.ListLinkedMagicElement.Add(new MagicCoreOffset(Params, AttackParams, 55, 0)); FireballCore1.ListLinkedMagicElement.Add(FireballCore2); FireballCore1.ListLinkedMagicElement.Add(FireballCore3); ActiveSpell.ListMagicCore.Add(FireballCore1); ActiveSpell = new MagicSpell(ActiveSpell, ActiveUser); BaseAutomaticSkill NewSkill = ActiveSpell.ComputeSpell()[0]; CreateFireballEffectTripleThunder Fireball1 = (CreateFireballEffectTripleThunder)NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect[0]; Fireball1.ChanneledMana = 2000; NewSkill.AddSkillEffectsToTarget(string.Empty); Constants.TotalGameTime = 10; NewSkill.AddSkillEffectsToTarget(string.Empty); DummyMap.ListLayer[0].ListAttackCollisionBox[0].ListCollisionPolygon[0].Center = new Vector2(10, 10); //Channel enough Mana for 2 fireballs for (int i = 0; i < 50; i++) { DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 0, 16))); } Constants.TotalGameTime = 20; DummyMap.ListLayer[0].ListAttackCollisionBox[0].Update(new GameTime(new TimeSpan(), new TimeSpan(0, 0, 0, 50, 0))); Assert.AreEqual(0, DummyMap.ListLayer[0].ListAttackCollisionBox[0].ListCollisionPolygon[0].Center.X); Assert.AreEqual(70, DummyMap.ListLayer[0].ListAttackCollisionBox[1].ListCollisionPolygon[0].Center.X); }
public void TestSkillActivation() { BaseAutomaticSkill DummySkill = CreateDummySkill(DummyMap.DicRequirement[TimeAliveRequirement.Name].Copy(), DummyMap.DicAutomaticSkillTarget[SelfAttackTargetType.Name].Copy(), DummyMap.DicEffect[LaunchAttackEffect.Name].Copy()); AttackContext.Owner = CreateDummyRobot(); AttackContext.OwnerProjectile = new HitscanBox(0, new ExplosionOptions(), AttackContext.Owner, Vector2.Zero, 0); DummySkill.AddSkillEffectsToTarget(string.Empty); }
private void tsmNewRequirement_Click(object sender, EventArgs e) { BaseAutomaticSkill NewSkill = new BaseAutomaticSkill(); NewSkill.Name = "Dummy Skill"; NewSkill.ListSkillLevel.Add(new BaseSkillLevel()); NewSkill.CurrentLevel = 1; BaseSkillActivation NewActivation = new BaseSkillActivation(); NewSkill.CurrentSkillLevel.ListActivation.Add(NewActivation); NewActivation.ListRequirement.Add(DicRequirement.First().Value.Copy()); NewActivation.ListEffectTarget.Add(new List <string>()); NewActivation.ListEffect.Add(DicEffect.First().Value.Copy()); TreeNode SelectedNode = tvSkills.SelectedNode; TreeNode EffectNode = null; if (SelectedNode != null) { BaseAutomaticSkill ActiveSkill = SelectedNode.Tag as BaseAutomaticSkill; if (ActiveSkill != null) { EffectNode = SelectedNode.Parent; } else { while (ActiveSkill == null) { ActiveSkill = SelectedNode.Parent.Tag as BaseAutomaticSkill; if (ActiveSkill != null) { EffectNode = SelectedNode; } SelectedNode = SelectedNode.Parent; } } BaseEffect ActiveEffect = ActiveSkill.ListSkillLevel[0].ListActivation[0].ListEffect[lstEffects.SelectedIndex]; ActiveEffect.ListFollowingSkill.Add(NewSkill); } if (tvSkills.SelectedNode != null) { CreateTree(NewSkill, EffectNode.Nodes); } else { CreateTree(NewSkill, tvSkills.Nodes); } }
public void TestShootSkillRequirementFail() { BaseAutomaticSkill DummySkill = CreateDummySkill(DummyMap.DicRequirement[ShootRequirement.Name].Copy(), DummyMap.DicAutomaticSkillTarget[SelfTargetType.Name].Copy(), DummyMap.DicEffect[ShootWeaponEffect.Name].Copy()); RobotContext.Target = CreateDummyRobot(); DummySkill.AddSkillEffectsToTarget(string.Empty); List <BaseEffect> ListActiveEffect = RobotContext.Target.Effects.GetActiveEffects("Dummy"); Assert.AreEqual(0, ListActiveEffect.Count); }
public ProjectEternityCharacterSkillEditor(string FilePath, object[] Params) : this() { this.FilePath = FilePath; if (!File.Exists(FilePath)) { FileStream fs = File.Create(FilePath); fs.Close(); ActiveSkill = new BaseAutomaticSkill(); SaveItem(FilePath, FilePath); } LoadSkill(this.FilePath); }
public void TestShootSkillRequirementSuccess() { BaseAutomaticSkill DummySkill = CreateDummySkill(DummyMap.DicRequirement[ShootRequirement.Name].Copy(), DummyMap.DicAutomaticSkillTarget[SelfTargetType.Name].Copy(), DummyMap.DicEffect[ShootWeaponEffect.Name].Copy()); RobotContext.Target = CreateDummyRobot(); RobotContext.TargetWeapon = RobotContext.Target.PrimaryWeapons.ActiveWeapons[0]; DummySkill.AddSkillEffectsToTarget("Shoot"); List <BaseEffect> ListActiveEffect = RobotContext.Target.Effects.GetActiveEffects("Dummy"); Assert.AreEqual(0, ListActiveEffect.Count);//Should be 0 as shooting doesn't store its effect. }
private BaseAutomaticSkill CreateSpell(BaseEffect CurrentSpell, MagicUserContext GlobalContext) { BaseAutomaticSkill NewSkill = BaseAutomaticSkill.CreateDummy(Name); //Insert a second activation use only for passive effects, should never have any requirement. Insert at 0 so they're processed before the spell requirements. NewSkill.CurrentSkillLevel.ListActivation.Insert(0, new BaseSkillActivation()); NewSkill.CurrentSkillLevel.ListActivation[1].ListEffect.Add(CurrentSpell); NewSkill.CurrentSkillLevel.ListActivation[1].ListEffectTargetReal.Add(new List <AutomaticSkillTargetType>() { new EffectActivationSelf(GlobalContext) }); return(NewSkill); }
public void TestTimeAliveRequirementFail() { TimeAliveRequirement NewRequirement = (TimeAliveRequirement)DummyMap.DicRequirement[TimeAliveRequirement.Name].Copy(); NewRequirement.TimeToWait = 1000; BaseAutomaticSkill DummySkill = CreateDummySkill(NewRequirement, DummyMap.DicAutomaticSkillTarget[SelfAttackTargetType.Name].Copy(), DummyMap.DicEffect[LaunchAttackEffect.Name].Copy()); AttackContext.Owner = CreateDummyRobot(); AttackContext.OwnerProjectile = new HitscanBox(0, new ExplosionOptions(), AttackContext.Owner, Vector2.Zero, 0); DummySkill.AddSkillEffectsToTarget("Shoot"); List <BaseEffect> ListActiveEffect = AttackContext.Owner.Effects.GetActiveEffects("Dummy"); Assert.AreEqual(0, ListActiveEffect.Count); }
public override void SaveItem(string ItemPath, string ItemName, bool ForceOverwrite = false) { //Create the Part file. FileStream FS = new FileStream(ItemPath, FileMode.Create, FileAccess.Write); BinaryWriter BW = new BinaryWriter(FS, Encoding.UTF8); BW.Write(tvSkills.Nodes.Count); foreach (TreeNode ActiveNode in tvSkills.Nodes) { BaseAutomaticSkill ActiveSkill = (BaseAutomaticSkill)ActiveNode.Tag; ActiveSkill.Save(BW); } FS.Close(); BW.Close(); }
public void TestPassiveRequirement() { Squad DummySquad = CreateDummySquad(); Squad DummyDefenderSquad = CreateDummySquad(); Unit DummyUnit = DummySquad.CurrentLeader; BaseAutomaticSkill TestSkill = CreateDummySkill(new PassiveRequirement()); DummyUnit.Pilot.ArrayPilotSkill = new BaseAutomaticSkill[1] { TestSkill }; var Result = DummyMap.CalculateFinalHP(DummySquad, null, 0, BattleMap.FormationChoices.Focused, DummyDefenderSquad, null, 1, 0, true, false); Assert.AreEqual(11980, Result.ArrayResult[0].AttackDamage); }
public void TestActivateSpiritEffect() { ActivateSpiritEffect NewEffect = (ActivateSpiritEffect)DummyMap.DicEffect[ActivateSpiritEffect.Name].Copy(); NewEffect.Value = ""; BaseAutomaticSkill DummySkill = CreateDummySkill(DummyMap.DicRequirement[PassiveRequirement.Name].Copy(), DummyMap.DicAutomaticSkillTarget[EffectActivationSelf.Name].Copy(), NewEffect); Squad DummySquad = CreateDummySquad(); GlobalDeathmatchContext.SetContext(DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, null); DummySkill.AddSkillEffectsToTarget(string.Empty); }
public void TestSkillActivation() { FinalDamageEffect NewRequirement = (FinalDamageEffect)DummyMap.DicEffect[FinalDamageEffect.Name].Copy(); NewRequirement.FinalDamageValue = "1000"; BaseAutomaticSkill DummySkill = CreateDummySkill(DummyMap.DicRequirement[PassiveRequirement.Name].Copy(), DummyMap.DicAutomaticSkillTarget[EffectActivationSelf.Name].Copy(), NewRequirement); Squad DummySquad = CreateDummySquad(); GlobalDeathmatchContext.SetContext(DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummySquad, DummySquad.CurrentLeader, DummySquad.CurrentLeader.Pilot, DummyMap.ActiveParser); DummySkill.AddSkillEffectsToTarget(string.Empty); }
public void TestCreatureModifierPhaseSkillActivation() { Player DummyPlayer1 = new Player("Player 1", "Human", true, false, 0, new Card[0]); Player DummyPlayer2 = new Player("Player 2", "Human", true, false, 0, new Card[0]); CreatureCard DummyInvaderCard = new CreatureCard(40, 20); CreatureCard DummyDefenderCard = new CreatureCard(40, 20); SorcererStreetMap DummyMap = CreateDummyMap(); SorcererStreetBattleParams BattleParams = new SorcererStreetBattleParams(DummyMap.GlobalSorcererStreetBattleContext); TerrainSorcererStreet DummyTerrain = DummyMap.GetTerrain(DummyPlayer2.GamePiece); DummyTerrain.DefendingCreature = DummyDefenderCard; DummyTerrain.Owner = DummyPlayer2; ActionPanelBattleStartPhase BattleStartPhase = new ActionPanelBattleStartPhase(DummyMap, 0, DummyInvaderCard); BattleStartPhase.Load(); BaseEffect SkillEffect = new IncreaseHPEffect(BattleParams); BaseSkillRequirement Requirement = new SorcererStreetCreaturePhaseRequirement(DummyMap.GlobalSorcererStreetBattleContext); AutomaticSkillTargetType Target = new SorcererStreetSelfTargetType(DummyMap.GlobalSorcererStreetBattleContext); BaseAutomaticSkill HPIncreaseSkill = new BaseAutomaticSkill(); HPIncreaseSkill.Name = "Dummy"; HPIncreaseSkill.ListSkillLevel.Add(new BaseSkillLevel()); HPIncreaseSkill.CurrentLevel = 1; BaseSkillActivation NewActivation = new BaseSkillActivation(); HPIncreaseSkill.CurrentSkillLevel.ListActivation.Add(NewActivation); NewActivation.ListRequirement.Add(Requirement); NewActivation.ListEffect.Add(SkillEffect); NewActivation.ListEffectTargetReal.Add(new List <AutomaticSkillTargetType>()); NewActivation.ListEffectTargetReal[0].Add(Target); DummyInvaderCard.ListSkill.Add(HPIncreaseSkill); ActionPanelBattleCreatureModifierPhase CreaturePhase = new ActionPanelBattleCreatureModifierPhase(DummyMap.ListActionMenuChoice, DummyMap); CreaturePhase.OnSelect(); Assert.AreEqual(DummyInvaderCard.CurrentHP + 30, DummyMap.GlobalSorcererStreetBattleContext.InvaderFinalHP); }
public void TestManualActivationHPBonus() { CreatureCard DummyInvaderCard = new CreatureCard(40, 20); CreatureCard DummyDefenderCard = new CreatureCard(40, 20); SorcererStreetBattleContext GlobalSorcererStreetBattleContext = new SorcererStreetBattleContext(); GlobalSorcererStreetBattleContext.Invader = DummyInvaderCard; GlobalSorcererStreetBattleContext.Defender = DummyDefenderCard; GlobalSorcererStreetBattleContext.Invader.ResetBonuses(); GlobalSorcererStreetBattleContext.Defender.ResetBonuses(); GlobalSorcererStreetBattleContext.InvaderFinalHP = GlobalSorcererStreetBattleContext.Invader.CurrentHP; GlobalSorcererStreetBattleContext.DefenderFinalHP = GlobalSorcererStreetBattleContext.Defender.CurrentHP; GlobalSorcererStreetBattleContext.InvaderFinalST = GlobalSorcererStreetBattleContext.Invader.CurrentST; GlobalSorcererStreetBattleContext.DefenderFinalST = GlobalSorcererStreetBattleContext.Defender.CurrentST; GlobalSorcererStreetBattleContext.UserCreature = GlobalSorcererStreetBattleContext.Invader; GlobalSorcererStreetBattleContext.OpponentCreature = GlobalSorcererStreetBattleContext.Defender; SorcererStreetBattleParams BattleParams = new SorcererStreetBattleParams(GlobalSorcererStreetBattleContext); BaseEffect SkillEffect = new IncreaseHPEffect(BattleParams); BaseSkillRequirement Requirement = new SorcererStreetCreaturePhaseRequirement(GlobalSorcererStreetBattleContext); AutomaticSkillTargetType Target = new SorcererStreetSelfTargetType(GlobalSorcererStreetBattleContext); BaseAutomaticSkill HPIncreaseSkill = new BaseAutomaticSkill(); HPIncreaseSkill.Name = "Dummy"; HPIncreaseSkill.ListSkillLevel.Add(new BaseSkillLevel()); HPIncreaseSkill.CurrentLevel = 1; BaseSkillActivation NewActivation = new BaseSkillActivation(); HPIncreaseSkill.CurrentSkillLevel.ListActivation.Add(NewActivation); NewActivation.ListRequirement.Add(Requirement); NewActivation.ListEffect.Add(SkillEffect); NewActivation.ListEffectTargetReal.Add(new List <AutomaticSkillTargetType>()); NewActivation.ListEffectTargetReal[0].Add(Target); HPIncreaseSkill.AddSkillEffectsToTarget(Requirement.SkillRequirementName); Assert.AreEqual(DummyInvaderCard.CurrentHP + 30, GlobalSorcererStreetBattleContext.InvaderFinalHP); }
public SkillLevelsEditor(string SkillName) { InitializeComponent(); DicRequirement = BaseSkillRequirement.LoadAllRequirements(); DicEffect = BaseEffect.LoadAllEffects(); lblName.Text = SkillName; dgvLevels.Rows.Clear(); BaseAutomaticSkill NewSkill = new BaseAutomaticSkill("Content/Characters/Skills/" + SkillName + ".pecs", DicRequirement, DicEffect); for (int L = 0; L < NewSkill.ListSkillLevel.Count; ++L) { dgvLevels.Rows.Add(L + 1, L + 1); } }
public void TestTimeAliveRequirementSuccess() { TimeAliveRequirement NewRequirement = (TimeAliveRequirement)DummyMap.DicRequirement[TimeAliveRequirement.Name].Copy(); NewRequirement.TimeToWait = 1000; BaseAutomaticSkill DummySkill = CreateDummySkill(NewRequirement, DummyMap.DicAutomaticSkillTarget[SelfAttackTargetType.Name].Copy(), DummyMap.DicEffect[LaunchAttackEffect.Name].Copy()); AttackContext.Owner = CreateDummyRobot(); AttackContext.OwnerProjectile = new HitscanBox(0, new ExplosionOptions(), AttackContext.Owner, Vector2.Zero, 0); DummySkill.AddSkillEffectsToTarget(string.Empty); AttackContext.OwnerProjectile.Update(new GameTime(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1))); DummySkill.AddSkillEffectsToTarget(string.Empty); List <BaseEffect> ListActiveEffect = AttackContext.Owner.Effects.GetActiveEffects("Dummy"); Assert.AreEqual(0, ListActiveEffect.Count);//Should be 0 as shooting doesn't store its effect. }