コード例 #1
0
 public Character()
 {
     this.InitiativeTiebreaker = rand.Next();
     monster  = Monster.BlankMonster();
     isNotSet = true;
     monster.PropertyChanged += Monster_PropertyChanged;
     HP    = monster.HP;
     MaxHP = monster.HP;
     initiativeFollowers = new ObservableCollection <Character>();
     initiativeFollowers.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(initiativeFollowers_CollectionChanged);
     resources = new ObservableCollection <ActiveResource>();
 }
コード例 #2
0
        public static RulesSystem?MonsterSystem(BaseMonster monster)
        {
            switch (monster)
            {
            case PF2Monster _:
                return(RulesSystem.PF2);

            case Monster _:
                return(RulesSystem.PF1);

            default:
                return(null);
            }
        }
コード例 #3
0
        public Character(Monster monster, HPMode mode) : this()
        {
            this.monster = (Monster)monster.Clone();

            this.name      = monster.Name;
            this.hp        = monster.GetStartingHP(mode);
            this.maxHP     = this.hp;
            this.isMonster = true;

            this.monster.ApplyDefaultConditions();


            this.monster.PropertyChanged += Monster_PropertyChanged;
            Resources = this.monster.TResources;
            LoadResources();
        }
コード例 #4
0
 public void BaseMonsterCopy(BaseMonster m)
 {
     CR         = m.cr;
     Alignment  = m.alignment;
     Size       = m.size;
     HP         = m.hp;
     Speed      = m.speed;
     Init       = m.init;
     Languages  = m.languages;
     HP_Mods    = m.hp_mods;
     Fort       = m.fort;
     Ref        = m.reflex;
     Will       = m.will;
     Resist     = m.resist;
     Weaknesses = m.weaknesses;
     Immune     = m.immune;
     Source     = m.source;
 }
コード例 #5
0
 public void BaseMonsterClone(BaseMonster m)
 {
     m.name       = name;
     m.cr         = cr;
     m.alignment  = alignment;
     m.size       = size;
     m.hp         = hp;
     m.speed      = speed;
     m.init       = init;
     m.languages  = languages;
     m.hp_mods    = hp_mods;
     m.fort       = fort;
     m.reflex     = reflex;
     m.will       = will;
     m.resist     = resist;
     m.weaknesses = weaknesses;
     m.immune     = immune;
     m.source     = source;
 }
コード例 #6
0
        private void SetMonster(BaseMonster value)
        {
            if (monster != value)
            {
                RulesSystem?oldSystem = MonsterSystem(monster);
                RulesSystem?newSystem = MonsterSystem(value);

                bool replacement = !isNotSet;
                if (monster != null)
                {
                    monster.PropertyChanged -= Monster_PropertyChanged;
                    monster.ActiveConditions.CollectionChanged -= ActiveConditions_CollectionChanged;
                }

                this.monster = value;

                if (monster != null)
                {
                    monster.PropertyChanged += Monster_PropertyChanged;
                    monster.ActiveConditions.CollectionChanged += ActiveConditions_CollectionChanged;
                }

                if (oldSystem != null)
                {
                    NotifyMonsterSystem(oldSystem.Value);
                }
                if (newSystem != null && (oldSystem == null || oldSystem.Value != newSystem.Value))
                {
                    NotifyMonsterSystem(newSystem.Value);
                }

                if (replacement && monster != null)
                {
                    MaxHP = monster.HP;
                    monster.Notify("Init");
                }

                isNotSet = false;
            }
        }