public Monster()
 {
     Name                  = "";
     Size                  = new CreatureSize();
     Source                = "User Custom";
     Type                  = "";
     HP                    = new HP();
     AC                    = new AC();
     InitiativeModifier    = 0;
     Tags                  = new SortableBindingList <string>();
     Speed                 = new SortableBindingList <BindableString>();
     Abilities             = new Abilities();
     DamageVulnerabilities = new SortableBindingList <BindableString>();
     DamageResistances     = new SortableBindingList <BindableString>();
     DamageImmunities      = new SortableBindingList <BindableString>();
     ConditionImmunities   = new SortableBindingList <BindableString>();
     Saves                 = new SortableBindingList <Save>();
     Skills                = new SortableBindingList <Skill>();
     Senses                = new SortableBindingList <BindableString>();
     Languages             = new SortableBindingList <BindableString>();
     Challenge             = new Fraction("0");
     Traits                = new SortableBindingList <Trait>();
     Actions               = new SortableBindingList <Action>();
     Reactions             = new SortableBindingList <Reaction>();
     LegendaryActions      = new SortableBindingList <LegendaryAction>();
     Spells                = new SortableBindingList <BindableString>();
     ReadOnly              = false;
 }
Exemple #2
0
 public static void SetWeaponFinesseSize(BaseItem baseItem, CreatureSize nSize)
 {
     Internal.NativeFunctions.nwnxSetFunction(PLUGIN_NAME, "SetWeaponFinesseSize");
     Internal.NativeFunctions.nwnxPushInt((int)nSize);
     Internal.NativeFunctions.nwnxPushInt((int)baseItem);
     Internal.NativeFunctions.nwnxCallFunction();
 }
 public DamageConditions(Conditions conditions, CreatureSize creatureSizeFilter, int escapeDC, int concurrentTargets)
 {
     ConcurrentTargets  = concurrentTargets;
     EscapeDC           = escapeDC;
     CreatureSizeFilter = creatureSizeFilter;
     Conditions         = conditions;
 }
Exemple #4
0
        public static int GetSpeed(CreatureSize size)
        {
            switch (size)
            {
            case CreatureSize.Tiny:
            case CreatureSize.Small:
            {
                return(4);
            }

            case CreatureSize.Medium:
            {
                return(6);
            }

            case CreatureSize.Large:
            {
                return(6);
            }

            case CreatureSize.Huge:
            {
                return(8);
            }

            case CreatureSize.Gargantuan:
            {
                return(10);
            }
            }
            return(6);
        }
Exemple #5
0
        public string CanCastSpell(NWCreature oPC, NWObject oTarget, int spellTier)
        {
            var          size    = _.GetCreatureSize(oTarget);
            CreatureSize maxSize = CreatureSize.Invalid;

            switch (spellTier)
            {
            case 1:
                maxSize = CreatureSize.Small;
                break;

            case 2:
                maxSize = CreatureSize.Medium;
                break;

            case 3:
                maxSize = CreatureSize.Large;
                break;

            case 4:
                maxSize = CreatureSize.Huge;
                break;
            }

            if (size > maxSize)
            {
                return("Your target is too large to force push.");
            }

            return(string.Empty);
        }
Exemple #6
0
        // Sets the creature size. Use CREATURE_SIZE_* constants
        public static void SetSize(uint creature, CreatureSize size)
        {
            Internal.NativeFunctions.nwnxSetFunction(PluginName, "SetSize");
            Internal.NativeFunctions.nwnxPushInt((int)size);
            Internal.NativeFunctions.nwnxPushObject(creature);

            Internal.NativeFunctions.nwnxCallFunction();
        }
Exemple #7
0
        //private void TestComplexRole(IRole iRole, RoleType roleType, RoleFlag rf, bool isLeader)
        //{
        //    ComplexRole cr = iRole as ComplexRole;
        //    Assert.IsNotNull(cr);
        //    Assert.AreEqual(isLeader, cr.Leader);
        //    Assert.AreEqual(roleType, cr.Type);
        //    Assert.AreEqual(rf, cr.Flag);
        //}

        //private static void TestMinion(Creature c, bool HasRole, RoleType? roleType)
        //{
        //    Minion cr = (Minion)c.Role;
        //    Assert.AreEqual(HasRole, cr.HasRole);
        //    if (roleType != null)
        //    {
        //        Assert.IsTrue(cr.HasRole);
        //        Assert.AreEqual(roleType, cr.Type);
        //    }
        //    else
        //    {
        //        Assert.IsFalse(cr.HasRole);
        //    }
        //}

        private void TestSizeOriginType(Creature c, CreatureSize creatureSize, CreatureOrigin creatureOrigin, CreatureType creatureType, int level, string keyword)
        {
            Assert.AreEqual(creatureSize, c.Size);
            Assert.AreEqual(creatureOrigin, c.Origin);
            Assert.AreEqual(creatureType, c.Type);
            Assert.AreEqual(level, c.Level);
            Assert.AreEqual(CleanForCompare(keyword), CleanForCompare(c.Keywords));
        }
Exemple #8
0
        public Attack AddGrapple(int savingThrow, CreatureSize includeCreatureSizes = CreatureSizes.All)
        {
            Damage damage = new Damage(DamageType.Condition, AttackKind.Any, Dice.NoRoll, TimePoint.Immediately, TimePoint.Immediately, Conditions.Grappled | Conditions.Restrained, savingThrow, Ability.strength | Ability.dexterity);

            damage.IncludeCreatureSizes = includeCreatureSizes;
            damages.Add(damage);
            return(this);
        }
Exemple #9
0
 public PersonalInfo(string name, CreatureSize size, RacialType type, string typeTag, string alignment)
 {
     Name      = name;
     Size      = size;
     Type      = type;
     TypeTag   = typeTag;
     Alignment = alignment;
 }
        /// <summary>
        /// Creates a copy of <see cref="MonsterModel"/>
        /// </summary>
        public MonsterModel(MonsterModel monsterModel) : base(monsterModel)
        {
            _size                = monsterModel.Size;
            _type                = monsterModel.Type;
            _alignment           = monsterModel.Alignment;
            _ac                  = monsterModel.AC;
            _hp                  = monsterModel.HP;
            _speed               = monsterModel.Speed;
            _str                 = monsterModel.Strength;
            _dex                 = monsterModel.Dexterity;
            _con                 = monsterModel.Constitution;
            _int                 = monsterModel.Intelligence;
            _wis                 = monsterModel.Wisdom;
            _cha                 = monsterModel.Charisma;
            _description         = monsterModel.Description;
            _saves               = new Dictionary <Ability, int>(monsterModel.Saves);
            _skills              = new Dictionary <Skill, int>(monsterModel.Skills);
            _resistances         = monsterModel.Resistances;
            _vulnerabilities     = monsterModel.Vulnerabilities;
            _immunities          = monsterModel.Immunities;
            _conditionImmunities = monsterModel.ConditionImmunities;
            _senses              = monsterModel.Senses;
            _passivePerception   = monsterModel.PassivePerception;
            _languages           = monsterModel.Languages;
            _cr                  = monsterModel.CR;
            _spells              = new List <string>(monsterModel.Spells);
            _spellSlots          = new List <string>(monsterModel.SpellSlots);

            _traits = new List <TraitModel>();
            foreach (TraitModel traitModel in monsterModel.Traits)
            {
                _traits.Add(new TraitModel(traitModel));
            }

            _actions = new List <MonsterActionModel>();
            foreach (MonsterActionModel monsterActionModel in monsterModel.Actions)
            {
                _actions.Add(new MonsterActionModel(monsterActionModel));
            }

            _reactions = new List <MonsterActionModel>();
            foreach (MonsterActionModel monsterActionModel in monsterModel.Reactions)
            {
                _reactions.Add(new MonsterActionModel(monsterActionModel));
            }

            _legendaryActions = new List <MonsterActionModel>();
            foreach (MonsterActionModel monsterActionModel in monsterModel.LegendaryActions)
            {
                _legendaryActions.Add(new MonsterActionModel(monsterActionModel));
            }

            _environment = monsterModel.Environment;

            _xml = monsterModel.XML;
        }
Exemple #11
0
    public static float GetCreatureAgeAtSize(CreatureSize size)
    {
        switch (size)
        {
        case CreatureSize.Small:
            return(0.0f);

        case CreatureSize.Medium:
            return(0.33f);

        case CreatureSize.Large:
            return(0.66f);
        }

        return(0.0f);
    }
Exemple #12
0
    public static float GetCreatureSizeScale(CreatureSize Size)
    {
        switch (Size)
        {
        case CreatureSize.Small:
            return(0.3f);

        case CreatureSize.Medium:
            return(0.4f);

        case CreatureSize.Large:
            return(0.6f);
        }

        return(1.0f);
    }
Exemple #13
0
    public static string GetCreatureSizeDisplayString(CreatureSize Size)
    {
        switch (Size)
        {
        case CreatureSize.Small:
            return("Small");

        case CreatureSize.Medium:
            return("Medium");

        case CreatureSize.Large:
            return("Large");
        }

        return("INVALID");
    }
Exemple #14
0
        /// <summary>
        /// Gets the square size of a creature of the given size.
        /// </summary>
        /// <param name="size">The creature size.</param>
        /// <returns>Returns the size in squares.</returns>
        public static int GetSize(CreatureSize size)
        {
            switch (size)
            {
            case CreatureSize.Large:
                return(2);

            case CreatureSize.Huge:
                return(3);

            case CreatureSize.Gargantuan:
                return(4);
            }

            return(1);
        }
Exemple #15
0
        /// <summary>
        /// Creates a copy of <see cref="RaceModel"/>
        /// </summary>
        public RaceModel(RaceModel raceModel) : base(raceModel)
        {
            _size                = raceModel.Size;
            _walkSpeed           = raceModel.WalkSpeed;
            _flySpeed            = raceModel.FlySpeed;
            _abilities           = new Dictionary <Ability, int>(raceModel.Abilities);
            _skillProficiencies  = new List <Skill>(raceModel.SkillProficiencies);
            _languages           = new List <string>(raceModel.Languages);
            _weaponProficiencies = new List <string>(raceModel.WeaponProficiencies);
            _armorProficiencies  = new List <string>(raceModel.ArmorProficiencies);
            _toolProficiencies   = new List <string>(raceModel.ToolProficiencies);
            _languageTrait       = raceModel.LanguageTrait;

            _traits = new List <TraitModel>();
            foreach (TraitModel traitModel in raceModel.Traits)
            {
                _traits.Add(new TraitModel(traitModel));
            }

            _xml = raceModel.XML;
        }
Exemple #16
0
 public PlayerRace(string name, CreatureSize size, int baseSpeed)
 {
     this.name      = name;
     this.size      = size;
     this.baseSpeed = baseSpeed;
 }
Exemple #17
0
 public SizeEqualTo(CreatureSize creatureSize)
 {
     CreatureSize = creatureSize;
 }
Exemple #18
0
        public void CollectDamages(Creature creature, List <Damage> mainDamages, List <Damage> successfulSavedDamages, int savingThrow, CreatureSize creatureSize)
        {
            hitPointChange = 0;
            foreach (Damage damage in successfulSavedDamages)
            {
                if (damage.Saves(savingThrow))
                {
                    if (damage.Conditions != Conditions.None)
                    {
                        if (damage.IncludeCreatureSizes.HasFlag(creatureSize))
                        {
                            conditionsAdded |= damage.Conditions;
                        }
                    }
                    if (damage.DamageType != DamageType.None && !creature.IsImmuneTo(damage.DamageType, damage.AttackKind))
                    {
                        damageTypes    |= damage.DamageType;
                        hitPointChange += (int)-Math.Round(damage.GetDamageRoll());
                    }
                }
            }

            foreach (Damage damage in mainDamages)
            {
                if (!damage.Saves(savingThrow))
                {
                    if (damage.Conditions != Conditions.None)
                    {
                        if (damage.IncludeCreatureSizes.HasFlag(creatureSize))
                        {
                            conditionsAdded |= damage.Conditions;
                            damageTypes     |= DamageType.Condition;
                        }
                    }
                    DamageType damageType = damage.DamageType & ~(DamageType.Condition | DamageType.None);
                    if (damageType != DamageType.None && !creature.IsImmuneTo(damageType, damage.AttackKind))
                    {
                        damageTypes    |= damageType;
                        hitPointChange += (int)-Math.Round(damage.GetDamageRoll());
                    }
                }
            }
        }
Exemple #19
0
        public Attack AddCondition(Conditions conditions, int savingThrow, Ability savingThrowAbility, CreatureSize includeCreatureSizes = CreatureSizes.All)
        {
            Damage damage = new Damage(DamageType.Condition, AttackKind.Any, Dice.NoRoll, TimePoint.Immediately, TimePoint.Immediately, conditions, savingThrow, savingThrowAbility);

            damage.Conditions           = conditions;
            damage.IncludeCreatureSizes = includeCreatureSizes;
            damages.Add(damage);
            return(this);
        }
Exemple #20
0
 public static T SetWieldingSize <T>(this T entity, CreatureSize value)
     where T : CharacterSizeDefinition
 {
     entity.SetField("wieldingSize", value);
     return(entity);
 }
Exemple #21
0
 private bool IsSize(RaceModel raceModel, CreatureSize size)
 {
     return(size == CreatureSize.None || raceModel.Size == size);
 }
Exemple #22
0
 public static T SetCarryingSize <T>(this T entity, CreatureSize value)
     where T : RulesetCharacter
 {
     entity.SetField("carryingSize", value);
     return(entity);
 }
Exemple #23
0
 public SizeSmallerThan(CreatureSize creatureSize)
 {
     CreatureSize = creatureSize;
 }
 public SizeGreaterThan(CreatureSize creatureSize)
 {
     CreatureSize = creatureSize;
 }
 private bool IsSize(MonsterModel monsterModel, CreatureSize size)
 {
     return(size == CreatureSize.None || monsterModel.Size == size);
 }
 //private void TestComplexRole(IRole iRole, RoleType roleType, RoleFlag rf, bool isLeader)
 //{
 //    ComplexRole cr = iRole as ComplexRole;
 //    Assert.IsNotNull(cr);
 //    Assert.AreEqual(isLeader, cr.Leader);
 //    Assert.AreEqual(roleType, cr.Type);
 //    Assert.AreEqual(rf, cr.Flag);
 //}
 //private static void TestMinion(Creature c, bool HasRole, RoleType? roleType)
 //{
 //    Minion cr = (Minion)c.Role;
 //    Assert.AreEqual(HasRole, cr.HasRole);
 //    if (roleType != null)
 //    {
 //        Assert.IsTrue(cr.HasRole);
 //        Assert.AreEqual(roleType, cr.Type);
 //    }
 //    else
 //    {
 //        Assert.IsFalse(cr.HasRole);
 //    }
 //}
 private void TestSizeOriginType(Creature c, CreatureSize creatureSize, CreatureOrigin creatureOrigin, CreatureType creatureType, int level, string keyword)
 {
     Assert.AreEqual(creatureSize, c.Size);
     Assert.AreEqual(creatureOrigin, c.Origin);
     Assert.AreEqual(creatureType, c.Type);
     Assert.AreEqual(level, c.Level);
     Assert.AreEqual(CleanForCompare(keyword), CleanForCompare(c.Keywords));
 }