public void AddConditionByName(string name) { if (!HasCondition(name)) { ActiveCondition c = new ActiveCondition(); c.Condition = Condition.ByName(name); Stats.AddCondition(c); } }
public void RemoveCondition(ActiveCondition c) { ActiveConditions.Remove(c); if (c.Bonus != null) { ApplyBonus(c.Bonus, true); } }
public void AddCondition(ActiveCondition c) { ActiveConditions.Add(c); if (c.Bonus != null) { ApplyBonus(c.Bonus, false); } }
public ActiveCondition(ActiveCondition a) { if (a._Condition != null) { _Condition = (Condition)a._Condition.Clone(); } _Turns = a._Turns; _EndTurn = a._EndTurn; if (a._InitiativeCount != null) { _InitiativeCount = (InitiativeCount)a._InitiativeCount.Clone(); } _Details = a._Details; }
private void AddCurrentCondition() { ActiveCondition ac = null; if (characters != null) { foreach (Character ch in characters) { Condition c = (Condition)conditionView.CurrentItem; if (c != null) { ac = new ActiveCondition(); ac.Condition = c; } if (ac != null) { if (this.RoundsRadioButton.IsChecked == true) { int val; if (int.TryParse(ConditionDurationText.Text, out val)) { ac.Turns = val; } } else { ac.Turns = null; } ac.InitiativeCount = InitiativeCount; ac.Details = DetailsTextBox.Text; ch.Stats.AddCondition(ac); Condition.PushRecentCondition(ac.Condition); } } DialogResult = true; Close(); } }
public Character(Monster monster, bool rollHP) : this() { this.monster = (Monster)monster.Clone(); this.name = monster.Name; if (!rollHP || !TryParseHP()) { this.hp = monster.HP; } this.maxHP = this.hp; this.isMonster = true; if (this.monster.HasDefensiveAbility("Incorporeal")) { ActiveCondition ac = new ActiveCondition(); ac.Condition = Condition.FindCondition("Incorporeal"); this.monster.AddCondition(ac); } LoadResources(); }
public Character(Monster monster, HPMode mode) : this() { this.monster = (Monster)monster.Clone(); this.name = monster.Name; if (mode == HPMode.Default || !TryParseHP(mode == HPMode.Max)) { this.hp = monster.HP; } this.maxHP = this.hp; this.isMonster = true; if (this.monster.HasDefensiveAbility("Incorporeal")) { ActiveCondition ac = new ActiveCondition(); ac.Condition = Condition.FindCondition("Incorporeal"); this.monster.AddCondition(ac); } Resources = this.monster.TResources; LoadResources(); }
public static CharacterActionResult TakeAction(CombatState state, CharacterActionType action, Character primaryChar, List <Character> allChars, object param) { CharacterActionResult res = CharacterActionResult.None; switch (action) { case CharacterActionType.MakeIdle: foreach (Character ch in allChars) { ch.IsIdle = true; } state.FilterList(); break; case CharacterActionType.RemoveIdle: foreach (Character ch in allChars) { ch.IsIdle = false; } state.FilterList(); break; case CharacterActionType.Clone: foreach (Character ch in allChars) { state.CloneCharacter(ch); } break; case CharacterActionType.Delete: foreach (Character ch in allChars) { state.RemoveCharacter(ch); } break; case CharacterActionType.MoveToMonsters: foreach (Character ch in allChars) { if (!ch.IsMonster) { state.RemoveCharacter(ch); ch.IsMonster = true; state.AddCharacter(ch); } } state.FilterList(); break; case CharacterActionType.MoveToParty: foreach (Character ch in allChars) { if (ch.IsMonster) { state.RemoveCharacter(ch); ch.IsMonster = false; state.AddCharacter(ch); } } state.FilterList(); break; case CharacterActionType.MoveUpInitiative: state.MoveUpCharacter(primaryChar); break; case CharacterActionType.MoveDownInitiative: state.MoveDownCharacter(primaryChar); break; case CharacterActionType.MoveAfterInitiative: state.MoveCharacterAfter(primaryChar, (Character)param); break; case CharacterActionType.MoveBeforeInitiative: state.MoveCharacterBefore(primaryChar, (Character)param); break; case CharacterActionType.RollInitiative: state.RollIndividualInitiative(primaryChar); state.SortCombatList(false, false); break; case CharacterActionType.Ready: primaryChar.IsReadying = !primaryChar.IsReadying; if (primaryChar.IsReadying && primaryChar.IsDelaying) { primaryChar.IsDelaying = false; } break; case CharacterActionType.Delay: primaryChar.IsDelaying = !primaryChar.IsDelaying; if (primaryChar.IsReadying && primaryChar.IsDelaying) { primaryChar.IsReadying = false; } break; case CharacterActionType.ActNow: if (primaryChar.IsIdle) { primaryChar.IsIdle = false; } state.CharacterActNow(primaryChar); break; case CharacterActionType.LinkInitiative: Character targetChar = (Character)param; if (primaryChar != targetChar && targetChar.InitiativeLeader == null) { state.LinkInitiative(primaryChar, (Character)param); } break; case CharacterActionType.UnlinkInitiative: state.UnlinkLeader(primaryChar); break; case CharacterActionType.AddConditon: if (param != null) { Condition c = (Condition)param; foreach (Character ch in allChars) { ActiveCondition a = new ActiveCondition(); a.Condition = c; ch.Stats.AddCondition(a); Condition.PushRecentCondition(a.Condition); } } else { res = CharacterActionResult.NeedConditionDialog; } break; case CharacterActionType.EditNotes: res = CharacterActionResult.NeedNotesDialog; break; case CharacterActionType.EditMonster: res = CharacterActionResult.NeedMonsterEditorDialog; break; case CharacterActionType.RollAttack: res = CharacterActionResult.RollAttack; break; case CharacterActionType.RollAttackSet: res = CharacterActionResult.RollAttackSet; break; case CharacterActionType.RollSave: res = CharacterActionResult.RollSave; break; case CharacterActionType.RollSkill: res = CharacterActionResult.RollSkill; break; } return(res); }