예제 #1
0
 /// <summary>
 /// creates a new weapon
 /// </summary>
 /// <param name="aName">the name of the weapon</param>
 /// <param name="aGlyph">the weapon glyph</param>
 /// <param name="aColor">the weapon colour</param>
 /// <param name="l">the weapon location.</param>
 /// <param name="aWProps">weapon properties</param>
 /// <param name="aLoc">worn location</param>
 /// <param name="aSubType">weapon subtype</param>
 public Weapon(string aName, char aGlyph, Colour aColor, Location3i l,
     WeaponProperties aWProps, WeaponLocation aLoc, WeaponSubType aSubType)
     : base(ItemType.Weapon, aName, aGlyph, aColor, l)
 {
     WeaponProperties = aWProps;
     WeaponSubType = aSubType;
     WeaponLocation = aLoc;
 }
예제 #2
0
    private Transform GetCurrentTranParent(WeaponSubType type)
    {
        switch (type)
        {
        case WeaponSubType.LongSword: return(sword_panel);

        case WeaponSubType.Katana: return(katana_panel);

        case WeaponSubType.Spear: return(null);

        case WeaponSubType.GiantAxe: return(axe_panel);

        case WeaponSubType.Gloves: return(fist_panel);

        default: return(null);
        }
    }
예제 #3
0
        public Weapon(string name, WeaponBaseType weaponBaseType, WeaponSubType weaponSubType, WeaponProficiencyType weaponProficiencyType, WeaponEffortType weaponEffortType, int[] mediumDamageRoll, WeaponAttackType weaponAttackType, int criticalMinRoll, int criticalMultiplier, WeaponDamageType[] weaponDamageTypes, int range, SizeType sizeType, double cost, double weight, string description) : base(name, cost, weight, description, slotType: SlotType.Weapon)
        {
            WeaponBaseType        = weaponBaseType;
            WeaponSubType         = weaponSubType;
            WeaponProficiencyType = weaponProficiencyType;
            WeaponEffortType      = weaponEffortType;
            MediumDamageRoll      = mediumDamageRoll;
            WeaponAttackType      = weaponAttackType;
            CriticalMinRoll       = criticalMinRoll;
            CriticalMultiplier    = criticalMultiplier;
            WeaponDamageTypes     = weaponDamageTypes;
            Range = range;

            SetSize(sizeType);

            // standard attack
            CombatActions.Add(CombatAction.CreateWeaponAttack(null, this, false));

            // full attack
            CombatActions.Add(CombatAction.CreateWeaponAttack(null, this, true));
        }
예제 #4
0
        // see EffectsManager.GetTargetComponents for order and logic
        internal static bool IsStatusEffectAffectingWeapon(StatisticEffectData statisticData, WeaponSubType subType, WeaponType type, WeaponCategoryValue categoryValue)
        {
            if (statisticData.targetCollection != TargetCollection.Weapon)
            {
                return(false);
            }

            if (statisticData.targetWeaponSubType != WeaponSubType.NotSet)
            {
                return(statisticData.targetWeaponSubType == subType);
            }
            else if (statisticData.targetWeaponType != WeaponType.NotSet)
            {
                return(statisticData.targetWeaponType == type);
            }
            else if (!statisticData.TargetWeaponCategoryValue.Is_NotSet)
            {
                return(statisticData.TargetWeaponCategoryValue.ID == categoryValue.ID);
            }

            return(true);
        }
예제 #5
0
        internal static T ModifyWeaponStatistic <T>(StatisticAdapter <T> stat, MechDef mechDef, WeaponSubType subType, WeaponType type, WeaponCategoryValue categoryValue)
        {
            var effects = new List <EffectData>();

            foreach (var componentDef in mechDef.Inventory.Where(x => x.IsFunctionalORInstalling()).Select(x => x.Def))
            {
                if (componentDef.statusEffects == null)
                {
                    continue;
                }

                foreach (var effectData in componentDef.statusEffects)
                {
                    if (effectData.effectType != EffectType.StatisticEffect)
                    {
                        continue;
                    }
                    if (effectData.targetingData.effectTriggerType != EffectTriggerType.Passive ||
                        effectData.targetingData.effectTargetType != EffectTargetType.Creator)
                    {
                        continue;
                    }
                    if (stat.Key != effectData.statisticData.statName)
                    {
                        continue;
                    }
                    if (!IsStatusEffectAffectingWeapon(effectData.statisticData, subType, type, categoryValue))
                    {
                        continue;
                    }
                    effects.Add(effectData);
                }
            }
            OrderedStatusEffectsFeature.Shared.SortEffectDataList(effects);
            foreach (var effect in effects)
            {
                stat.Modify(effect);
            }
            return(stat.Get());
        }
예제 #6
0
        // Rebuilt from StatTooltipData.GetEffectMod() to be used in the prefix patch of StatTooltipData.SetDurabilityData()
        public static float GetEffectMod(EffectData effectData, string statName, StatisticEffectData.TargetCollection target, StatCollection.StatOperation operation, WeaponSubType subTarget = WeaponSubType.NotSet)
        {
            StatisticEffectData statisticData = effectData.statisticData;

            if (statisticData != null && statisticData.statName == statName && statisticData.targetCollection == target && statisticData.operation == operation && statisticData.targetWeaponSubType == subTarget)
            {
                return(float.Parse(statisticData.modValue, CultureInfo.InvariantCulture));
            }
            return(0f);
        }