Esempio n. 1
0
        public static void Prefix(WeaponDamage __instance, ref AttackSkill ___m_attackSkill, out List <Weapon.WeaponType> __state)
        {
            __state = null;
            AttackSkill attackSkill = ___m_attackSkill;
            Weapon      weapon;

            if (attackSkill == null)
            {
                weapon = null;
            }
            else
            {
                Character ownerCharacter = attackSkill.OwnerCharacter;
                weapon = ((ownerCharacter != null) ? ownerCharacter.CurrentWeapon : null);
            }
            Weapon weapon2 = weapon;
            bool   flag    = weapon2 != null;

            if (flag)
            {
                Weapon.WeaponType valueOrDefault;
                bool flag2;
                if (___m_attackSkill.RequiredWeaponTypes != null)
                {
                    Weapon.WeaponType?bastardType = BehaviourManager.GetBastardType(weapon2.Type);
                    if (bastardType != null)
                    {
                        valueOrDefault = bastardType.GetValueOrDefault();
                        flag2          = true;
                    }
                    else
                    {
                        flag2 = false;
                    }
                }
                else
                {
                    flag2 = false;
                }
                bool flag3 = flag2;
                if (flag3)
                {
                    bool flag4 = ___m_attackSkill.RequiredWeaponTypes.Contains(valueOrDefault) && !___m_attackSkill.RequiredWeaponTypes.Contains(weapon2.Type) && BehaviourManager.IsBastardMode(weapon2);
                    if (flag4)
                    {
                        __state = ___m_attackSkill.RequiredWeaponTypes;
                        ___m_attackSkill.RequiredWeaponTypes = new List <Weapon.WeaponType>(__state);
                        ___m_attackSkill.RequiredWeaponTypes.Add(weapon2.Type);
                    }
                }
            }
        }
Esempio n. 2
0
        // Token: 0x06000007 RID: 7 RVA: 0x0000225C File Offset: 0x0000045C
        public static bool AdaptGrip(Character __instance, ref int _type, ref int _id)
        {
            Weapon weapon = (__instance != null) ? __instance.CurrentWeapon : null;
            bool   flag   = weapon == null;
            bool   result;

            if (flag)
            {
                result = false;
            }
            else
            {
                bool flag2 = _type == 2502;
                if (flag2)
                {
                    MeleeSkill meleeSkill = At.GetValue(typeof(Character), __instance, "m_lastUsedSkill") as MeleeSkill;
                    bool       flag3      = meleeSkill != null && meleeSkill.ActivateEffectAnimType == Character.SpellCastType.WeaponSkill1;
                    if (flag3)
                    {
                        bool flag4 = meleeSkill.RequiredWeaponTypes[0] != weapon.Type;
                        if (flag4)
                        {
                            CustomWeaponBehaviour.ChangeGrip(__instance, meleeSkill.RequiredWeaponTypes[0]);
                            return(true);
                        }
                    }
                }
                bool flag5 = weapon.HasTag(CustomWeaponBehaviour.FinesseTag);
                if (flag5)
                {
                    bool flag6 = _type == 1 && !BehaviourManager.IsComboAttack(__instance, _type, _id);
                    if (flag6)
                    {
                        CustomWeaponBehaviour.ChangeGrip(__instance, Weapon.WeaponType.Axe_1H);
                        return(true);
                    }
                }
                bool flag7 = BehaviourManager.IsHalfHandedMode(weapon);
                if (flag7)
                {
                    bool flag8 = _type == 1 && !BehaviourManager.IsComboAttack(__instance, _type, _id);
                    if (flag8)
                    {
                        CustomWeaponBehaviour.ChangeGrip(__instance, Weapon.WeaponType.Spear_2H);
                        return(true);
                    }
                }
                bool flag9 = BehaviourManager.IsBastardMode(weapon);
                if (flag9)
                {
                    Weapon.WeaponType?bastardType = BehaviourManager.GetBastardType(weapon.Type);
                    Weapon.WeaponType valueOrDefault;
                    bool flag10;
                    if (bastardType != null)
                    {
                        valueOrDefault = bastardType.GetValueOrDefault();
                        flag10         = true;
                    }
                    else
                    {
                        flag10 = false;
                    }
                    bool flag11 = flag10;
                    if (flag11)
                    {
                        bool flag12 = _type != 2502;
                        if (flag12)
                        {
                            CustomWeaponBehaviour.ChangeGrip(__instance, valueOrDefault);
                            return(true);
                        }
                    }
                }
                result = false;
            }
            return(result);
        }