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);
        }
Пример #2
0
        private void lstActivations_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstActivations.SelectedItems.Count > 0)
            {
                gbRequirements.Enabled = true;
                gbEffects.Enabled      = true;
                lstRequirements.Items.Clear();
                lstEffects.Items.Clear();

                BaseSkillActivation ActiveSkillActivation = ActiveSkill.ListSkillLevel[lstLevels.SelectedIndex].ListActivation[lstActivations.SelectedIndex];
                txtActivationChance.Value = ActiveSkillActivation.ActivationPercentage;
                txtActivationWeight.Value = ActiveSkillActivation.Weight;
                for (int A = 0; A < ActiveSkillActivation.ListRequirement.Count; A++)
                {
                    lstRequirements.Items.Add(ActiveSkillActivation.ListRequirement[A].SkillRequirementName);
                }
                for (int E = 0; E < ActiveSkillActivation.ListEffect.Count; E++)
                {
                    lstEffects.Items.Add(ActiveSkillActivation.ListEffect[E].ToString());
                }
                if (lstRequirements.Items.Count > 0)
                {
                    lstRequirements.SelectedIndex = 0;
                }
                if (lstEffects.Items.Count > 0)
                {
                    lstEffects.SelectedIndex = 0;
                }
            }
            else
            {
                gbRequirements.Enabled = false;
                gbEffects.Enabled      = false;
            }
        }
Пример #3
0
        private void btnRemoveEffect_Click(object sender, EventArgs e)
        {
            if (lstLevels.SelectedItems.Count > 0 && lstActivations.SelectedItems.Count > 0 && lstEffects.SelectedItems.Count > 0)
            {
                BaseSkillActivation ActiveSkillActivation = ActiveSkill.ListSkillLevel[lstLevels.SelectedIndex].ListActivation[lstActivations.SelectedIndex];

                ActiveSkillActivation.ListEffect.RemoveAt(lstEffects.SelectedIndex);
                ActiveSkillActivation.ListEffectTarget.RemoveAt(lstEffects.SelectedIndex);
                lstEffects.Items.RemoveAt(lstEffects.SelectedIndex);
            }
        }
        private void btnAddLevel_Click(object sender, EventArgs e)
        {
            BaseSkillLevel      NewSkillLevel      = new BaseSkillLevel();
            BaseSkillActivation NewSkillActivation = new BaseSkillActivation();

            NewSkillLevel.ListActivation.Add(NewSkillActivation);

            ActiveSkill.ListSkillLevel.Add(NewSkillLevel);
            lstLevels.Items.Add("Level " + (lstLevels.Items.Count + 1));

            lstLevels.SelectedIndex = lstLevels.Items.Count - 1;
        }
        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);
            }
        }
Пример #6
0
        private void btnAddEffects_Click(object sender, EventArgs e)
        {
            if (lstLevels.SelectedItems.Count > 0 && lstActivations.SelectedItems.Count > 0)
            {
                BaseSkillActivation ActiveSkillActivation = ActiveSkill.ListSkillLevel[lstLevels.SelectedIndex].ListActivation[lstActivations.SelectedIndex];
                BaseEffect          NewEffect             = DicEffect.First().Value;
                NewEffect.LifetimeType = SkillEffect.LifetimeTypePermanent;

                ActiveSkillActivation.ListEffect.Add(NewEffect);
                ActiveSkillActivation.ListEffectTarget.Add(new List <string>());
                lstEffects.Items.Add("Auto Dodge effect");
                lstEffects.SelectedIndex = lstEffects.Items.Count - 1;
            }
        }
        private void lstEffects_SelectedIndexChanged(object sender, EventArgs e)
        {
            AllowEvents = false;

            if (lstEffects.SelectedItems.Count > 0)
            {
                BaseSkillActivation ActiveSkillActivation = ActiveSkill.ListSkillLevel[lstLevels.SelectedIndex].ListActivation[0];
                BaseEffect          ActiveEffect          = ActiveSkillActivation.ListEffect[lstEffects.SelectedIndex];
                List <string>       ListEffectActivation  = ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex];
                pgEffect.SelectedObject = ActiveEffect;
                cboEffectType.Text      = pgEffect.SelectedObject.ToString();
            }

            AllowEvents = true;
        }
        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);
        }
        private BaseAutomaticSkill CreateDummySkill(BaseSkillRequirement Requirement, AutomaticSkillTargetType Target, BaseEffect Effect)
        {
            BaseAutomaticSkill NewSkill = new BaseAutomaticSkill();

            NewSkill.Name = "Dummy";
            NewSkill.ListSkillLevel.Add(new BaseSkillLevel());
            NewSkill.CurrentLevel = 1;

            BaseSkillActivation NewActivation = new BaseSkillActivation();

            NewSkill.CurrentSkillLevel.ListActivation.Add(NewActivation);

            NewActivation.ListRequirement.Add(Requirement);

            NewActivation.ListEffect.Add(Effect);
            NewActivation.ListEffectTargetReal.Add(new List <AutomaticSkillTargetType>());
            NewActivation.ListEffectTargetReal[0].Add(Target);

            return(NewSkill);
        }
        private void lstLevels_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstLevels.SelectedItems.Count > 0)
            {
                gbEffects.Enabled = true;
                lstEffects.Items.Clear();

                BaseSkillActivation ActiveSkillActivation = ActiveSkill.ListSkillLevel[lstLevels.SelectedIndex].ListActivation[0];
                for (int E = 0; E < ActiveSkillActivation.ListEffect.Count; E++)
                {
                    lstEffects.Items.Add(ActiveSkillActivation.ListEffect[E].ToString());
                }
                if (lstEffects.Items.Count > 0)
                {
                    lstEffects.SelectedIndex = 0;
                }
            }
            else
            {
                gbEffects.Enabled = false;
            }
        }
Пример #12
0
        private void UpdateEffect(object sender, EventArgs e)
        {
            if (!AllowEvents)
            {
                return;
            }

            if (lstEffects.SelectedItems.Count > 0 && lstActivations.SelectedItems.Count > 0)
            {
                BaseSkillActivation ActiveSkillActivation = ActiveSkill.ListSkillLevel[lstLevels.SelectedIndex].ListActivation[lstActivations.SelectedIndex];
                BaseEffect          ActiveEffect          = ActiveSkillActivation.ListEffect[lstEffects.SelectedIndex];

                ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Clear();

                if (cbAffectSelf.Checked)
                {
                    ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Add(cbAffectSelf.Text);
                }
                if (cbAffectSquad.Checked)
                {
                    ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Add(cbAffectSquad.Text);
                }
                if (cbAffectAura.Checked)
                {
                    ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Add(cbAffectAura.Text);
                }
                if (cbAffectEnemy.Checked)
                {
                    ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Add(cbAffectEnemy.Text);
                }
                if (cbAffectSquadEnemy.Checked)
                {
                    ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Add(cbAffectSquadEnemy.Text);
                }
                if (cbAffectAuraEnemy.Checked)
                {
                    ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Add(cbAffectAuraEnemy.Text);
                }
                if (cbAffectAll.Checked)
                {
                    ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Add(cbAffectAll.Text);
                }
                if (cbAffectALLAllies.Checked)
                {
                    ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Add(cbAffectALLAllies.Text);
                }
                if (cbAffectAllEnemy.Checked)
                {
                    ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex].Add(cbAffectAllEnemy.Text);
                }

                if (txtRangeValue.Enabled)
                {
                    ActiveEffect.Range = (int)txtRangeValue.Value;
                }

                if (rbLifetimePermanent.Checked)
                {
                    ActiveEffect.LifetimeType  = SkillEffect.LifetimeTypePermanent;
                    txtMaximumLifetime.Enabled = false;
                }
                else if (rbLifetimeTurns.Checked)
                {
                    ActiveEffect.LifetimeType      = SkillEffect.LifetimeTypeTurns;
                    ActiveEffect.LifetimeTypeValue = (int)txtMaximumLifetime.Value;
                    txtMaximumLifetime.Enabled     = true;
                }
                else if (rbLifetimeBattle.Checked)
                {
                    ActiveEffect.LifetimeType      = SkillEffect.LifetimeTypeBattle;
                    ActiveEffect.LifetimeTypeValue = (int)txtMaximumLifetime.Value;
                    txtMaximumLifetime.Enabled     = true;
                }

                ActiveEffect.IsStacking = cbLifetimeStacking.Checked;
                if (ActiveEffect.IsStacking)
                {
                    ActiveEffect.MaximumStack = (int)txtMaximumStack.Value;
                    txtMaximumStack.Enabled   = true;
                }
                else
                {
                    cbLifetimeStacking.Checked = false;
                    txtMaximumStack.Value      = 0;
                    txtMaximumStack.Enabled    = false;
                }
            }
        }
Пример #13
0
        private void lstEffects_SelectedIndexChanged(object sender, EventArgs e)
        {
            AllowEvents = false;

            if (lstEffects.SelectedItems.Count > 0 && lstActivations.SelectedItems.Count > 0)
            {
                gbAffectedTypes.Enabled = true;
                gbLifetimeTypes.Enabled = true;

                BaseSkillActivation ActiveSkillActivation = ActiveSkill.ListSkillLevel[lstLevels.SelectedIndex].ListActivation[lstActivations.SelectedIndex];
                BaseEffect          ActiveEffect          = ActiveSkillActivation.ListEffect[lstEffects.SelectedIndex];
                List <string>       ListEffectActivation  = ActiveSkillActivation.ListEffectTarget[lstEffects.SelectedIndex];
                pgEffect.SelectedObject = ActiveEffect;
                cboEffectType.Text      = pgEffect.SelectedObject.ToString();

                //Affect types.
                cbAffectSelf.Checked       = ListEffectActivation.Contains(cbAffectSelf.Text);
                cbAffectSquad.Checked      = ListEffectActivation.Contains(cbAffectSquad.Text);
                cbAffectAura.Checked       = ListEffectActivation.Contains(cbAffectAura.Text);
                cbAffectEnemy.Checked      = ListEffectActivation.Contains(cbAffectEnemy.Text);
                cbAffectSquadEnemy.Checked = ListEffectActivation.Contains(cbAffectSquadEnemy.Text);
                cbAffectAuraEnemy.Checked  = ListEffectActivation.Contains(cbAffectAuraEnemy.Text);
                cbAffectAll.Checked        = ListEffectActivation.Contains(cbAffectAll.Text);
                cbAffectALLAllies.Checked  = ListEffectActivation.Contains(cbAffectALLAllies.Text);
                cbAffectAllEnemy.Checked   = ListEffectActivation.Contains(cbAffectAllEnemy.Text);

                txtRangeValue.Enabled = cbAffectAura.Checked | cbAffectAuraEnemy.Checked;
                if (txtRangeValue.Enabled)
                {
                    txtRangeValue.Value = ActiveEffect.Range;
                }

                //Lifetime types.
                if (ActiveEffect.LifetimeType == SkillEffect.LifetimeTypePermanent)
                {
                    rbLifetimePermanent.Checked = true;
                    txtMaximumLifetime.Enabled  = false;
                }
                else if (ActiveEffect.LifetimeType == SkillEffect.LifetimeTypeTurns)
                {
                    rbLifetimeTurns.Checked    = true;
                    txtMaximumLifetime.Value   = ActiveEffect.LifetimeTypeValue;
                    txtMaximumLifetime.Enabled = true;
                }
                else if (ActiveEffect.LifetimeType == SkillEffect.LifetimeTypeBattle)
                {
                    rbLifetimeBattle.Checked   = true;
                    txtMaximumLifetime.Value   = ActiveEffect.LifetimeTypeValue;
                    txtMaximumLifetime.Enabled = true;
                }

                if (ActiveEffect.IsStacking)
                {
                    cbLifetimeStacking.Checked = true;
                    txtMaximumStack.Enabled    = true;
                    txtMaximumStack.Value      = ActiveEffect.MaximumStack;
                }
                else
                {
                    cbLifetimeStacking.Checked = false;
                    txtMaximumStack.Value      = 0;
                    txtMaximumStack.Enabled    = false;
                }
            }
            else
            {
                gbAffectedTypes.Enabled = false;
                gbLifetimeTypes.Enabled = false;
            }

            AllowEvents = true;
        }