public static int DispatchProjectileDestroyed(this GameObject attacker, GameObject projectile,
                                                  D20CAF caf)
    {
        DispIoAttackBonus dispIo = DispIoAttackBonus.Default;

        dispIo.attackPacket.dispKey     = 1;
        dispIo.attackPacket.d20ActnType = D20ActionType.STANDARD_ATTACK;
        dispIo.attackPacket.attacker    = attacker;

        GameObject weapon;

        if (caf.HasFlag(D20CAF.SECONDARY_WEAPON))
        {
            weapon = GameSystems.Item.GetItemAtInvIdx(attacker, 204);
        }
        else
        {
            weapon = GameSystems.Item.GetItemAtInvIdx(attacker, 203);
        }

        if (weapon != null && weapon.type == ObjectType.weapon)
        {
            dispIo.attackPacket.weaponUsed = weapon;
        }

        dispIo.attackPacket.ammoItem = projectile;
        dispIo.attackPacket.flags    = caf;
        return(GameSystems.Stat.DispatchAttackBonus(attacker, null, ref dispIo, DispatcherType.ProjectileDestroyed,
                                                    0));
    }
示例#2
0
 public static void DealSpellDamage(this GameObject victim, GameObject attacker, DamageType damageType,
                                    Dice dice,
                                    D20AttackPower attackPower = D20AttackPower.NORMAL,
                                    int reduction            = 100,
                                    D20ActionType actionType = D20ActionType.NONE,
                                    int spellId       = 0,
                                    D20CAF flags      = 0,
                                    int projectileIdx = 0)
 {
     // Line 105: Saving Throw
     GameSystems.D20.Combat.DealWeaponlikeSpellDamage(victim, attacker, dice, damageType, attackPower, reduction, 105,
                                                      actionType, spellId, flags, projectileIdx);
 }
示例#3
0
    public GameObject GetAttackWeapon(GameObject obj, int attackCode, D20CAF flags)
    {
        if (flags.HasFlag(D20CAF.TOUCH_ATTACK) && !flags.HasFlag(D20CAF.THROWN_GRENADE))
        {
            return(null);
        }

        if (flags.HasFlag(D20CAF.SECONDARY_WEAPON))
        {
            return(GameSystems.Item.ItemWornAt(obj, EquipSlot.WeaponSecondary));
        }

        if (UsingSecondaryWeapon(obj, attackCode))
        {
            return(GameSystems.Item.ItemWornAt(obj, EquipSlot.WeaponSecondary));
        }

        if (attackCode > AttackPacket.ATTACK_CODE_NATURAL_ATTACK)
        {
            return(null);
        }

        return(GameSystems.Item.ItemWornAt(obj, EquipSlot.WeaponPrimary));
    }