Пример #1
0
 public DamageNature(DamageNature nature)
 {
     Form       = nature.Form;
     Source     = nature.Source;
     Type       = nature.Type;
     WeaponHand = nature.WeaponHand;
     WeaponType = nature.WeaponType;
 }
            static void Postfix(RulesetCharacterHero __instance, ref RulesetAttackMode __result, ref WeaponDescription weaponDescription)
            {
                DamageForm           firstDamageForm = __result.EffectDescription.FindFirstDamageForm();
                WeaponTypeDefinition element         = DatabaseRepository.GetDatabase <WeaponTypeDefinition>().GetElement(weaponDescription.WeaponType);
                int originalAbilityScoreModifier     = AttributeDefinitions.ComputeAbilityScoreModifier(__instance.Attributes[__result.AbilityScore].CurrentValue);

                __result.AbilityScore = element.WeaponProximity == RuleDefinitions.AttackProximity.Melee ? "Strength" : "Dexterity";
                if (weaponDescription.WeaponTags.Contains("Finesse") && __instance.GetAttribute("Dexterity").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue)
                {
                    __result.AbilityScore = "Dexterity";
                }
                if (weaponDescription.WeaponTags.Contains("Knowledge") && __instance.GetAttribute("Intelligence").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue)
                {
                    __result.AbilityScore = "Intelligence";
                }
                if (weaponDescription.WeaponTags.Contains("Intuition") && __instance.GetAttribute("Wisdom").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue)
                {
                    __result.AbilityScore = "Wisdom";
                }
                if (weaponDescription.WeaponTags.Contains("Vigor") && __instance.GetAttribute("Constitution").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue)
                {
                    __result.AbilityScore = "Constitution";
                }
                if (weaponDescription.WeaponTags.Contains("Influence") && __instance.GetAttribute("Charisma").CurrentValue > __instance.GetAttribute(__result.AbilityScore).CurrentValue)
                {
                    __result.AbilityScore = "Charisma";
                }

                int abilityScoreModifier = AttributeDefinitions.ComputeAbilityScoreModifier(__instance.Attributes[__result.AbilityScore].CurrentValue);

                Predicate <RuleDefinitions.TrendInfo> predicate = FindAbilityScoreTrend;
                int ability_score_to_hit_trend_index            = __result.ToHitBonusTrends.FindIndex(predicate);
                int ability_score_damage_bonus_trend_index      = firstDamageForm.DamageBonusTrends.FindIndex(predicate);

                if (ability_score_to_hit_trend_index >= 0)
                {
                    __result.ToHitBonus -= originalAbilityScoreModifier;
                    __result.ToHitBonus += abilityScoreModifier;
                    __result.ToHitBonusTrends.RemoveAt(ability_score_to_hit_trend_index);
                    __result.ToHitBonusTrends.Add(new RuleDefinitions.TrendInfo(abilityScoreModifier, RuleDefinitions.FeatureSourceType.AbilityScore, __result.AbilityScore, (object)null));
                }

                if (ability_score_damage_bonus_trend_index >= 0)
                {
                    firstDamageForm.DamageBonusTrends.RemoveAt(ability_score_damage_bonus_trend_index);
                    firstDamageForm.BonusDamage -= originalAbilityScoreModifier;
                    firstDamageForm.BonusDamage += abilityScoreModifier;
                    firstDamageForm.DamageBonusTrends.Add(new RuleDefinitions.TrendInfo(abilityScoreModifier, RuleDefinitions.FeatureSourceType.AbilityScore, __result.AbilityScore, (object)null));
                }
            }
Пример #3
0
 void Die(DamageForm form)
 {
     switch (form)
     {
         case DamageForm.Predator_Waving_Claw:
             Debug.Log("Die behead!");
             DieBehead();
             break;
         case DamageForm.Predator_Strike_Single_Claw:
         default:
             StartCoroutine(DieNormally());
             break;
     }
     return;
 }
Пример #4
0
    void Die(DamageForm form)
    {
        switch (form)
        {
        case DamageForm.Predator_Waving_Claw:
            Debug.Log("Die behead!");
            DieBehead();
            break;

        case DamageForm.Predator_Strike_Single_Claw:
        default:
            StartCoroutine(DieNormally());
            break;
        }
        return;
    }
Пример #5
0
        public EffectFormBuilder SetDamageForm(bool versatile, RuleDefinitions.DieType versatileDieType, string damageType, int bonusDamage,
                                               RuleDefinitions.DieType dieType, int diceNumber, RuleDefinitions.HealFromInflictedDamage healFromInflictedDamage,
                                               List <RuleDefinitions.TrendInfo> damageBonusTrends)
        {
            effectForm.FormType = EffectForm.EffectFormType.Damage;
            DamageForm damageForm = new DamageForm();

            damageForm.SetVersatile(versatile);
            damageForm.VersatileDieType = versatileDieType;
            damageForm.BonusDamage      = bonusDamage;
            damageForm.DamageType       = damageType;
            damageForm.DiceNumber       = diceNumber;
            damageForm.DieType          = dieType;
            damageForm.SetHealFromInflictedDamage(healFromInflictedDamage);
            damageForm.SetField("damageBonusTrends", damageBonusTrends);
            effectForm.DamageForm = damageForm;
            return(this);
        }
Пример #6
0
 private void SetFromKeywords(IEnumerable <string> words)
 {
     foreach (string word in words)
     {
         if (Forms.ContainsKey(word))
         {
             Form |= Forms[word];
         }
         if (Types.ContainsKey(word))
         {
             Type = Types[word];
         }
         if (Weapon.Types.ContainsKey(word))
         {
             WeaponType = Weapon.Types[word];
         }
         if (Sources.ContainsKey(word))
         {
             Source = Sources[word];
         }
     }
 }
Пример #7
0
 public bool Is(DamageForm form)
 {
     return (Form & form) != 0;
 }
Пример #8
0
 public DamageNature(List<string> keywords)
 {
     foreach (string word in keywords)
     {
         if (Forms.ContainsKey(word)) Form |= Forms[word];
         if (Weapon.Types.ContainsKey(word)) WeaponType = Weapon.Types[word];
         if (Sources.ContainsKey(word)) Source = Sources[word];
     }
 }
Пример #9
0
            public DamageNature(DamageSource source, string str)
            {
                Source = source;

                string[] words = str.Split(' ');
                foreach (string word in words)
                {
                    if (Forms.ContainsKey(word)) Form |= Forms[word];
                    if (Types.ContainsKey(word)) Type = Types[word];
                    if (Weapon.Types.ContainsKey(word)) WeaponType = Weapon.Types[word];
                    if (Sources.ContainsKey(word)) Source = Sources[word];
                }
            }
Пример #10
0
            public DamageNature(DamageNature nature, string str)
            {
                Form = nature.Form;
                Source = nature.Source;
                Type = nature.Type;
                WeaponHand = nature.WeaponHand;
                WeaponType = nature.WeaponType;

                string[] words = str.Split(' ');
                foreach (string word in words)
                {
                    if (Forms.ContainsKey(word)) Form |= Forms[word];
                    if (Types.ContainsKey(word)) Type = Types[word];
                    if (Weapon.Types.ContainsKey(word)) WeaponType = Weapon.Types[word];
                    if (Sources.ContainsKey(word)) Source = Sources[word];
                }
            }
Пример #11
0
 public DamageNature(DamageNature nature)
 {
     Form = nature.Form;
     Source = nature.Source;
     Type = nature.Type;
     WeaponHand = nature.WeaponHand;
     WeaponType = nature.WeaponType;
 }
Пример #12
0
        // Merges attributes of specified gem.
        public void Merge(Gem gem)
        {
            // Take properties from parameter if they are not specified here.
            if (!ExcludeFormSpecified && gem.ExcludeFormSpecified)
            {
                ExcludeForm = gem.ExcludeForm;
            }
            if (!ExcludeFormSupportSpecified && gem.ExcludeFormSupportSpecified)
            {
                ExcludeFormSupport = gem.ExcludeFormSupport;
            }
            if (!ExcludeSourceSpecified && gem.ExcludeSourceSpecified)
            {
                ExcludeSource = gem.ExcludeSource;
            }
            if (!HitsPerAttackSpecified && gem.HitsPerAttackSpecified)
            {
                HitsPerAttack = gem.HitsPerAttack;
            }
            if (!IncludeFormSpecified && gem.IncludeFormSpecified)
            {
                IncludeForm = gem.IncludeForm;
            }
            if (!RequiresEquippedShieldSpecified && gem.RequiresEquippedShieldSpecified)
            {
                RequiresEquippedShield = gem.RequiresEquippedShield;
            }
            if (!RequiredHandSpecified && gem.RequiredHandSpecified)
            {
                RequiredHand = gem.RequiredHand;
            }
            if (!RequiredWeaponSpecified && gem.RequiredWeaponSpecified)
            {
                RequiredWeapon = gem.RequiredWeapon;
            }
            if (!StrikesWithBothWeaponsSpecified && gem.StrikesWithBothWeaponsSpecified)
            {
                StrikesWithBothWeapons = gem.StrikesWithBothWeapons;
            }
            if (!UnarmedSpecified && gem.UnarmedSpecified)
            {
                Unarmed = gem.Unarmed;
            }

            if (gem.Attributes != null)
            {
                if (Attributes == null)
                {
                    Attributes = new List <GemAttribute>();
                }

                foreach (GemAttribute attr in gem.Attributes)
                {
                    attr.Optimize();
                    // Find existing attribute to merge with.
                    GemAttribute with = Attributes.Find(a => a.Name == attr.Name);
                    if (with == null)
                    {
                        Attributes.Add(attr);
                    }
                    else
                    {
                        if (!with.NoUpdate)
                        {
                            // Sort values by priority so less specific values won't overwrite more specific ones.
                            attr.Values.Sort(new ValuePriorityComparer {
                                Reversed = true
                            });

                            foreach (Value value in attr.Values)
                            {
                                with.Merge(value);
                            }

                            with.CleanUp();
                        }
                    }
                }

                // Sort gem attribute values logically.
                Comparer <Value> comparer = new ValueLogicalComparer();
                foreach (GemAttribute attr in Attributes)
                {
                    attr.Values.Sort(comparer);
                }
            }
        }
Пример #13
0
 public bool Is(DamageForm form)
 {
     return((Form & form) != 0);
 }
Пример #14
0
 public PredatorPlayerAttackCommand(DamageForm _damageForm, Vector3? _direction, float _Strength)
 {
     damageForm = _damageForm;
     direction = _direction;
     Strength = _Strength;
 }
Пример #15
0
 public DamageParameter(GameObject source, DamageForm form, float point)
 {
     this.src = source;
     this.damageForm = form;
     this.damagePoint = point;
 }
Пример #16
0
 public DamageParameter(GameObject source, DamageForm form, float point)
 {
     this.src         = source;
     this.damageForm  = form;
     this.damagePoint = point;
 }
Пример #17
0
 public PredatorPlayerAttackCommand(DamageForm _damageForm, Vector3?_direction, float _Strength)
 {
     damageForm = _damageForm;
     direction  = _direction;
     Strength   = _Strength;
 }