Exemplo n.º 1
0
        public EffectForm(OngoingCondition condition, Hero hero)
        {
            InitializeComponent();

            foreach (string c in Conditions.GetConditions())
            {
                ConditionBox.Items.Add(c);
            }

            foreach (DamageType dt in Enum.GetValues(typeof(DamageType)))
            {
                DamageTypeBox.Items.Add(dt);
                DamageModTypeBox.Items.Add(dt);
            }

            DamageModDirBox.Items.Add(RESIST);
            DamageModDirBox.Items.Add(VULNERABLE);
            DamageModDirBox.Items.Add(IMMUNE);

            DurationBox.Items.Add(ENCOUNTER);
            DurationBox.Items.Add(SAVE_ENDS);
            DurationBox.Items.Add(START);
            DurationBox.Items.Add(END);

            DurationCreatureBox.Items.Add(hero);
            DurationCreatureBox.Items.Add(SOMEONE_ELSE);

            Application.Idle += new EventHandler(Application_Idle);

            init(condition, null, -1);
        }
Exemplo n.º 2
0
 private void RemoveBtn_Click(object sender, EventArgs e)
 {
     if (this.SelectedEffect != null)
     {
         CombatData       first  = this.SelectedEffect.First;
         OngoingCondition second = this.SelectedEffect.Second;
         first.Conditions.Remove(second);
         this.update_list();
     }
 }
Exemplo n.º 3
0
 private void AddBtn_Click(object sender, EventArgs e)
 {
     if (this.SelectedEffect != null)
     {
         Dictionary <OngoingCondition, int> item = this.fRolls;
         Dictionary <OngoingCondition, int> ongoingConditions = item;
         OngoingCondition selectedEffect = this.SelectedEffect;
         item[selectedEffect] = ongoingConditions[selectedEffect] + 1;
         this.update_list();
     }
 }
Exemplo n.º 4
0
        private void RemoveBtn_Click(object sender, EventArgs e)
        {
            if (SelectedEffect != null)
            {
                CombatData       cd = SelectedEffect.First;
                OngoingCondition oc = SelectedEffect.Second;

                cd.Conditions.Remove(oc);
                update_list();
            }
        }
Exemplo n.º 5
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            OngoingCondition ongoingCondition = new OngoingCondition();
            EffectForm       effectForm       = new EffectForm(ongoingCondition, this.fEncounter, this.fCurrentActor, this.fCurrentRound);

            if (effectForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.fData.Conditions.Add(effectForm.Effect);
                this.update_effects();
            }
        }
Exemplo n.º 6
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            OngoingCondition oc = new OngoingCondition();

            EffectForm dlg = new EffectForm(oc, fEncounter, fCurrentActor, fCurrentRound);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                fData.Conditions.Add(dlg.Effect);
                update_effects();
            }
        }
Exemplo n.º 7
0
        private void EffectAddBtn_Click(object sender, EventArgs e)
        {
            OngoingCondition oc = new OngoingCondition();

            EffectForm dlg = new EffectForm(oc, fHero);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                fHero.Effects.Add(dlg.Effect);
                update_effects();
            }
        }
Exemplo n.º 8
0
 private void EditBtn_Click(object sender, EventArgs e)
 {
     if (this.SelectedEffect != null)
     {
         CombatData       first  = this.SelectedEffect.First;
         OngoingCondition second = this.SelectedEffect.Second;
         int        num          = first.Conditions.IndexOf(second);
         EffectForm effectForm   = new EffectForm(second, this.fEncounter, this.fCurrentActor, this.fCurrentRound);
         if (effectForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             first.Conditions[num] = effectForm.Effect;
             this.update_list();
         }
     }
 }
Exemplo n.º 9
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            if (SelectedEffect != null)
            {
                CombatData       cd = SelectedEffect.First;
                OngoingCondition oc = SelectedEffect.Second;

                int index = cd.Conditions.IndexOf(oc);

                EffectForm dlg = new EffectForm(oc, fEncounter, fCurrentActor, fCurrentRound);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    cd.Conditions[index] = dlg.Effect;
                    update_list();
                }
            }
        }
Exemplo n.º 10
0
        public EffectForm(OngoingCondition condition, Encounter enc, CombatData current_actor, int current_round)
        {
            InitializeComponent();

            foreach (string c in Conditions.GetConditions())
            {
                ConditionBox.Items.Add(c);
            }

            foreach (DamageType dt in Enum.GetValues(typeof(DamageType)))
            {
                DamageTypeBox.Items.Add(dt);
                DamageModTypeBox.Items.Add(dt);
            }

            DamageModDirBox.Items.Add(RESIST);
            DamageModDirBox.Items.Add(VULNERABLE);
            DamageModDirBox.Items.Add(IMMUNE);

            DurationBox.Items.Add(ENCOUNTER);
            DurationBox.Items.Add(SAVE_ENDS);
            DurationBox.Items.Add(START);
            DurationBox.Items.Add(END);

            foreach (EncounterSlot slot in enc.Slots)
            {
                foreach (CombatData cd in slot.CombatData)
                {
                    DurationCreatureBox.Items.Add(cd);
                }
            }
            foreach (Hero hero in Session.Project.Heroes)
            {
                DurationCreatureBox.Items.Add(hero);
            }
            foreach (Trap trap in enc.Traps)
            {
                DurationCreatureBox.Items.Add(trap);
            }

            Application.Idle += new EventHandler(Application_Idle);

            init(condition, current_actor, current_round);
        }
Exemplo n.º 11
0
        private void update_list()
        {
            OngoingCondition selectedEffect = this.SelectedEffect;

            this.EffectList.BeginUpdate();
            this.EffectList.Items.Clear();
            foreach (OngoingCondition condition in this.fData.Conditions)
            {
                if (condition.Duration != DurationType.SaveEnds)
                {
                    continue;
                }
                int          value    = (int)this.ModBox.Value;
                int          item     = this.fRolls[condition];
                ListViewItem grayText = this.EffectList.Items.Add(condition.ToString(this.fEncounter, false));
                grayText.Tag = condition;
                if (condition == selectedEffect)
                {
                    grayText.Selected = true;
                }
                if (item == 0)
                {
                    grayText.SubItems.Add("(not rolled)");
                    grayText.SubItems.Add("(not rolled)");
                    grayText.ForeColor = SystemColors.GrayText;
                }
                else if (item == -2147483648)
                {
                    grayText.SubItems.Add("-");
                    grayText.SubItems.Add("Not saved");
                }
                else if (item != 2147483647)
                {
                    int savingThrowModifier = item + condition.SavingThrowModifier + value;
                    if (savingThrowModifier != item)
                    {
                        grayText.SubItems.Add(string.Concat(item, " => ", savingThrowModifier));
                    }
                    else
                    {
                        grayText.SubItems.Add(item.ToString());
                    }
                    if (savingThrowModifier < 10)
                    {
                        grayText.SubItems.Add("Not saved");
                    }
                    else
                    {
                        grayText.SubItems.Add("Saved");
                        grayText.ForeColor = SystemColors.GrayText;
                    }
                }
                else
                {
                    grayText.SubItems.Add("-");
                    grayText.SubItems.Add("Saved");
                    grayText.ForeColor = SystemColors.GrayText;
                }
            }
            if (this.EffectList.Items.Count == 0)
            {
                ListViewItem listViewItem = this.EffectList.Items.Add("(no conditions)");
                listViewItem.ForeColor = SystemColors.GrayText;
            }
            this.EffectList.EndUpdate();
        }
Exemplo n.º 12
0
 public RemoveEffectCommand(CombatData data, OngoingCondition effect)
 {
     _data   = data;
     _effect = effect;
 }
Exemplo n.º 13
0
        private void update_list()
        {
            OngoingCondition selection = SelectedEffect;

            EffectList.BeginUpdate();
            EffectList.Items.Clear();
            foreach (OngoingCondition oc in fData.Conditions)
            {
                if (oc.Duration != DurationType.SaveEnds)
                {
                    continue;
                }

                int mod  = (int)ModBox.Value;
                int roll = fRolls[oc];

                ListViewItem lvi = EffectList.Items.Add(oc.ToString(fEncounter, false));
                lvi.Tag = oc;
                if (oc == selection)
                {
                    lvi.Selected = true;
                }

                if (roll == 0)
                {
                    lvi.SubItems.Add("(not rolled)");
                    lvi.SubItems.Add("(not rolled)");

                    lvi.ForeColor = SystemColors.GrayText;
                }
                else if (roll == int.MinValue)
                {
                    lvi.SubItems.Add("-");
                    lvi.SubItems.Add("Not saved");
                }
                else if (roll == int.MaxValue)
                {
                    lvi.SubItems.Add("-");
                    lvi.SubItems.Add("Saved");
                    lvi.ForeColor = SystemColors.GrayText;
                }
                else
                {
                    int result = roll + oc.SavingThrowModifier + mod;

                    if (result == roll)
                    {
                        lvi.SubItems.Add(roll.ToString());
                    }
                    else
                    {
                        lvi.SubItems.Add(roll + " => " + result);
                    }

                    if (result >= 10)
                    {
                        lvi.SubItems.Add("Saved");
                        lvi.ForeColor = SystemColors.GrayText;
                    }
                    else
                    {
                        lvi.SubItems.Add("Not saved");
                    }
                }
            }

            if (EffectList.Items.Count == 0)
            {
                ListViewItem lvi = EffectList.Items.Add("(no conditions)");
                lvi.ForeColor = SystemColors.GrayText;
            }

            EffectList.EndUpdate();
        }
Exemplo n.º 14
0
        void init(OngoingCondition condition, CombatData current_actor, int current_round)
        {
            fHeights[ConditionBtn] = ConditionPanel.Height;
            fHeights[DamageBtn]    = DamagePanel.Height;
            fHeights[DefenceBtn]   = DefencePanel.Height;
            fHeights[DamageModBtn] = DamageModPanel.Height;
            fHeights[RegenBtn]     = RegenPanel.Height;
            fHeights[AuraBtn]      = AuraPanel.Height;

            fCondition    = condition.Copy();
            fCurrentActor = current_actor;
            fCurrentRound = current_round;

            ConditionBtn.Checked = (fCondition.Type == OngoingType.Condition);
            ConditionBox.Text    = (fCondition.Data != "") ? fCondition.Data : BLANK_EFFECT;

            DamageBtn.Checked          = (fCondition.Type == OngoingType.Damage);
            DamageBox.Value            = fCondition.Value;
            DamageTypeBox.SelectedItem = fCondition.DamageType;

            DefenceBtn.Checked  = (fCondition.Type == OngoingType.DefenceModifier);
            DefenceModBox.Value = fCondition.DefenceMod;
            if (fCondition.Defences.Count == 0)
            {
                fCondition.Defences.Add(DefenceType.AC);
            }
            ACBox.Checked   = fCondition.Defences.Contains(DefenceType.AC);
            FortBox.Checked = fCondition.Defences.Contains(DefenceType.Fortitude);
            RefBox.Checked  = fCondition.Defences.Contains(DefenceType.Reflex);
            WillBox.Checked = fCondition.Defences.Contains(DefenceType.Will);

            if (fCondition.DamageModifier.Value < 0)
            {
                DamageModDirBox.SelectedItem = RESIST;
            }
            if (fCondition.DamageModifier.Value > 0)
            {
                DamageModDirBox.SelectedItem = VULNERABLE;
            }
            if (fCondition.DamageModifier.Value == 0)
            {
                DamageModDirBox.SelectedItem = IMMUNE;
            }
            DamageModValueBox.Value       = Math.Abs(fCondition.DamageModifier.Value);
            DamageModTypeBox.SelectedItem = fCondition.DamageModifier.Type;

            RegenValueBox.Value     = fCondition.Regeneration.Value;
            RegenConditionsBox.Text = fCondition.Regeneration.Details;

            AuraRadiusBox.Value = fCondition.Aura.Radius;
            AuraDetailsBox.Text = fCondition.Aura.Description;

            switch (fCondition.Duration)
            {
            case DurationType.Encounter:
                DurationBox.SelectedItem = ENCOUNTER;
                break;

            case DurationType.SaveEnds:
                DurationBox.SelectedItem = SAVE_ENDS;
                ModBox.Value             = fCondition.SavingThrowModifier;
                break;

            case DurationType.BeginningOfTurn:
                DurationBox.SelectedItem = START;
                break;

            case DurationType.EndOfTurn:
                DurationBox.SelectedItem = END;
                break;
            }

            if (fCondition.DurationCreatureID != Guid.Empty)
            {
                DurationCreatureBox.SelectedItem = get_item(fCondition.DurationCreatureID);
            }
            else
            {
                if (fCurrentActor != null)
                {
                    DurationCreatureBox.SelectedItem = get_item(fCurrentActor.ID);
                }
                else
                {
                    DurationCreatureBox.SelectedItem = DurationCreatureBox.Items[0];
                }
            }
        }