예제 #1
0
        public PowerAttackForm(PowerAttack attack, bool functional_template, int level, IRole role)
        {
            InitializeComponent();

            Array defences = Enum.GetValues(typeof(DefenceType));

            foreach (DefenceType defence in defences)
            {
                DefenceBox.Items.Add(defence);
            }

            Application.Idle += new EventHandler(Application_Idle);

            fAttack             = attack.Copy();
            fFunctionalTemplate = functional_template;
            fLevel = level;
            fRole  = role;

            BonusBox.Value          = fAttack.Bonus;
            DefenceBox.SelectedItem = fAttack.Defence;

            set_suggestion();

            if (!fFunctionalTemplate)
            {
                InfoLbl.Visible = false;
                Height         -= InfoLbl.Height;
            }
        }
예제 #2
0
        private void AttackBtn_Click(object sender, EventArgs e)
        {
            PowerAttack     attack          = this.fPower.Attack ?? new PowerAttack();
            PowerAttackForm powerAttackForm = new PowerAttackForm(attack, this.fFunctionalTemplate, 0, null);

            if (powerAttackForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.fPower.Attack = powerAttackForm.Attack;
                this.update_attack();
                this.update_advice();
            }
        }
예제 #3
0
 protected void AreEqual(PowerAttack mp, PowerAttack ddi, string Name)
 {
     if (mp == null)
     {
         Assert.IsNull(ddi, "Attack not null " + Name);
         return;
     }
     else
     {
         Assert.IsNotNull(ddi, "Attack null for " + Name);
     }
     Assert.AreEqual(mp.Bonus, ddi.Bonus);
     Assert.AreEqual(mp.Defence, ddi.Defence);
     Assert.AreEqual(mp.ToString(), ddi.ToString());
 }
예제 #4
0
        /// <summary>
        /// Checks a text to see if there's an attack definition in it : adds it if found
        /// </summary>
        /// <param name="text">The text.</param>
        /// <returns>PowerAttack, or null if fail</returns>
        protected PowerAttack TryToGetAttackFrom(string text)
        {
            Match match = _regIsAttack.Match(text); //Try to look for range ?

            if (match.Success)
            {
                string      temp = match.Value;
                PowerAttack pa   = new PowerAttack();
                pa.Bonus   = GetIntValue(temp, null);
                temp       = temp.Substring(temp.IndexOf("vs") + 3).Trim();
                pa.Defence = (DefenceType)(Enum.Parse(typeof(DefenceType), temp));
                return(pa);
            }
            return(null);
        }
예제 #5
0
        private void AttackBtn_Click(object sender, EventArgs e)
        {
            PowerAttack pa = fPower.Attack;

            if (pa == null)
            {
                pa = new PowerAttack();
            }

            PowerAttackForm dlg = new PowerAttackForm(pa, fFunctionalTemplate, 0, null);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                fPower.Attack = dlg.Attack;
                update_attack();
                update_advice();
            }
        }
예제 #6
0
 public PowerAttackForm(PowerAttack attack, bool functional_template, int level, IRole role)
 {
     this.InitializeComponent();
     foreach (DefenceType value in Enum.GetValues(typeof(DefenceType)))
     {
         this.DefenceBox.Items.Add(value);
     }
     Application.Idle        += new EventHandler(this.Application_Idle);
     this.fAttack             = attack.Copy();
     this.fFunctionalTemplate = functional_template;
     this.fLevel                  = level;
     this.fRole                   = role;
     this.BonusBox.Value          = this.fAttack.Bonus;
     this.DefenceBox.SelectedItem = this.fAttack.Defence;
     this.set_suggestion();
     if (!this.fFunctionalTemplate)
     {
         this.InfoLbl.Visible = false;
         PowerAttackForm height = this;
         height.Height = height.Height - this.InfoLbl.Height;
     }
 }
예제 #7
0
        public static void AdjustPowerLevel(CreaturePower cp, int delta)
        {
            if (cp.Attack != null)
            {
                PowerAttack attack = cp.Attack;
                attack.Bonus = attack.Bonus + delta;
            }
            string str = AI.ExtractDamage(cp.Details);

            if (str != "")
            {
                DiceExpression diceExpression = DiceExpression.Parse(str);
                if (diceExpression != null)
                {
                    DiceExpression diceExpression1 = diceExpression.Adjust(delta);
                    if (diceExpression1 != null && diceExpression.ToString() != diceExpression1.ToString())
                    {
                        cp.Details = cp.Details.Replace(str, string.Concat(diceExpression1, " damage"));
                    }
                }
            }
        }
예제 #8
0
 public Warrior(string characterType, int level) : base(characterType, level)
 {
     CurrentHealth         = level * level * 10;
     MaxHealth             = level * level * 10;
     Damage                = 1.8;
     MaxDamage             = Damage;
     Defense               = 100;
     MaxDefense            = Defense;
     Energy                = 0;
     EnergyFillRate        = 5;
     CurrentQueueSize      = 0;
     MaxQueueSize          = 3;
     CriticalPercentage    = 15;
     MaxCriticalPercentage = CriticalPercentage;
     MissPercentage        = 10;
     MaxMissPercentage     = MissPercentage;
     ExperienceMultiplier  = 1.0;
     GoldMultiplier        = 1.0;
     attackOne             = new Attack();
     attackTwo             = new PowerAttack();
     attackThree           = new Defend();
     attackFour            = new Crush();
 }
예제 #9
0
        public LevelScene(bool grantCampaignEquipment) : base()
        {
            // Defaults
            this.isSinglePlayer = true;

            // UI State
            UIHandler.SetUIOptions(false, false);
            UIHandler.SetMenu(null, false);

            // Create UI
            this.levelUI = new LevelUI();

            // Generate Each Room Class
            this.rooms = new RoomScene[8];

            for (byte roomID = 0; roomID < Systems.handler.levelContent.data.rooms.Count; roomID++)
            {
                this.rooms[roomID] = new RoomScene(this, roomID);
            }

            // If we're on single player,
            Systems.localServer.ResetPlayers();

            // Restart the level, generate all rooms.
            this.RestartLevel(true);

            // Update Character with World Map abilities (if applicable)
            if (grantCampaignEquipment)
            {
                Character     character = Systems.localServer.MyCharacter;
                CampaignState campaign  = Systems.handler.campaignState;

                // Update Character Equipment
                if (campaign is CampaignState)
                {
                    if (character.suit is Suit == false || !character.suit.IsPowerSuit)
                    {
                        Suit.AssignToCharacter(character, campaign.suit, true);
                    }
                    if ((character.hat is Hat == false || !character.hat.IsPowerHat) && (character.hat == null || !character.hat.IsCosmeticHat || campaign.hat != 0))
                    {
                        Hat.AssignToCharacter(character, campaign.hat, true);
                    }
                    if (character.shoes is Shoes == false)
                    {
                        Shoes.AssignShoe(character, campaign.shoes);
                    }
                    if (character.attackPower is PowerAttack == false)
                    {
                        PowerAttack.AssignPower(character, campaign.powerAtt);
                    }
                    if (character.mobilityPower is PowerMobility == false)
                    {
                        PowerMobility.AssignPower(character, campaign.powerMob);
                    }
                    if (character.wounds.Health < campaign.health)
                    {
                        character.wounds.SetHealth(campaign.health);
                    }
                    if (character.wounds.Armor < campaign.armor)
                    {
                        character.wounds.SetArmor(campaign.armor);
                    }
                }
            }

            // Play or Stop Music
            Systems.music.Play((byte)Systems.handler.levelContent.data.music);
        }
예제 #10
0
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            IRole role;

            if (e.Url.Scheme == "power")
            {
                if (e.Url.LocalPath == "info")
                {
                    e.Cancel = true;
                    PowerInfoForm powerInfoForm = new PowerInfoForm(this.fPower);
                    if (powerInfoForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Name     = powerInfoForm.PowerName;
                        this.fPower.Keywords = powerInfoForm.PowerKeywords;
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "action")
                {
                    e.Cancel = true;
                    PowerActionForm powerActionForm = new PowerActionForm(this.fPower.Action);
                    if (powerActionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Action = powerActionForm.Action;
                        this.refresh_examples();
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "prerequisite")
                {
                    e.Cancel = true;
                    DetailsForm detailsForm = new DetailsForm(this.fPower.Condition, "Power Prerequisite", null);
                    if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Condition = detailsForm.Details;
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "range")
                {
                    e.Cancel = true;
                    PowerRangeForm powerRangeForm = new PowerRangeForm(this.fPower);
                    if (powerRangeForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Range = powerRangeForm.PowerRange;
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "attack")
                {
                    e.Cancel = true;
                    PowerAttack attack = this.fPower.Attack ?? new PowerAttack();
                    int         num    = (this.fCreature != null ? this.fCreature.Level : 0);
                    if (this.fCreature != null)
                    {
                        role = this.fCreature.Role;
                    }
                    else
                    {
                        role = null;
                    }
                    PowerAttackForm powerAttackForm = new PowerAttackForm(attack, this.fFromFunctionalTemplate, num, role);
                    if (powerAttackForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Attack = powerAttackForm.Attack;
                        this.refresh_examples();
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "clearattack")
                {
                    e.Cancel           = true;
                    this.fPower.Attack = null;
                    this.refresh_examples();
                    this.update_statblock();
                }
                if (e.Url.LocalPath == "details")
                {
                    e.Cancel = true;
                    PowerDetailsForm powerDetailsForm = new PowerDetailsForm(this.fPower.Details, this.fCreature);
                    if (powerDetailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Details = powerDetailsForm.Details;
                        this.update_statblock();
                    }
                }
                if (e.Url.LocalPath == "desc")
                {
                    e.Cancel = true;
                    DetailsForm detailsForm1 = new DetailsForm(this.fPower.Description, "Power Description", null);
                    if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        this.fPower.Description = detailsForm1.Details;
                        this.update_statblock();
                    }
                }
            }
            if (e.Url.Scheme == "details")
            {
                if (e.Url.LocalPath == "refresh")
                {
                    e.Cancel = true;
                    this.refresh_examples();
                    this.update_statblock();
                }
                try
                {
                    int num1 = int.Parse(e.Url.LocalPath);
                    e.Cancel            = true;
                    this.fPower.Details = this.fExamples[num1];
                    this.fExamples.RemoveAt(num1);
                    if (this.fExamples.Count == 0)
                    {
                        this.refresh_examples();
                    }
                    this.update_statblock();
                }
                catch
                {
                }
            }
        }
예제 #11
0
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.Scheme == "power")
            {
                if (e.Url.LocalPath == "info")
                {
                    e.Cancel = true;

                    PowerInfoForm dlg = new PowerInfoForm(fPower);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Name     = dlg.PowerName;
                        fPower.Keywords = dlg.PowerKeywords;

                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "action")
                {
                    e.Cancel = true;

                    PowerAction     action = fPower.Action;
                    PowerActionForm dlg    = new PowerActionForm(action);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Action = dlg.Action;

                        refresh_examples();
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "prerequisite")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fPower.Condition, "Power Prerequisite", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Condition = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "range")
                {
                    e.Cancel = true;

                    PowerRangeForm dlg = new PowerRangeForm(fPower);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Range = dlg.PowerRange;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "attack")
                {
                    e.Cancel = true;

                    PowerAttack attack = fPower.Attack;
                    if (attack == null)
                    {
                        attack = new PowerAttack();
                    }

                    int             level = (fCreature != null) ? fCreature.Level : 0;
                    IRole           role  = (fCreature != null) ? fCreature.Role : null;
                    PowerAttackForm dlg   = new PowerAttackForm(attack, fFromFunctionalTemplate, level, role);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Attack = dlg.Attack;

                        refresh_examples();
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "clearattack")
                {
                    e.Cancel = true;

                    fPower.Attack = null;

                    refresh_examples();
                    update_statblock();
                }

                if (e.Url.LocalPath == "details")
                {
                    e.Cancel = true;

                    PowerDetailsForm dlg = new PowerDetailsForm(fPower.Details, fCreature);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Details = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "desc")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fPower.Description, "Power Description", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fPower.Description = dlg.Details;
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "details")
            {
                if (e.Url.LocalPath == "refresh")
                {
                    e.Cancel = true;

                    refresh_examples();
                    update_statblock();
                }

                try
                {
                    int index = int.Parse(e.Url.LocalPath);
                    e.Cancel = true;

                    fPower.Details = fExamples[index];
                    fExamples.RemoveAt(index);

                    if (fExamples.Count == 0)
                    {
                        refresh_examples();
                    }

                    update_statblock();
                }
                catch
                {
                    // Not a number
                }
            }
        }
예제 #12
0
 protected void AreEqual(PowerAttack mp, PowerAttack ddi, string Name)
 {
     if (mp == null)
     {
         Assert.IsNull(ddi, "Attack not null " + Name);
         return;
     }
     else
     {
         Assert.IsNotNull(ddi, "Attack null for " + Name);
     }
     Assert.AreEqual(mp.Bonus, ddi.Bonus);
     Assert.AreEqual(mp.Defence, ddi.Defence);
     Assert.AreEqual(mp.ToString(), ddi.ToString());
 }