コード例 #1
0
    public void equip(EquipData equip_data, bool mainside = true)
    {
        string target = null;

        switch (equip_data.slot)
        {
        case Slot.arm_dual: unequip("arm_main"); unequip("arm_off"); target = "arm_dual"; break;

        case Slot.arm:
            unequip("arm_dual");
            if (!parent_actor.has_tech("dual_wield"))
            {
                // If Actor cannot dual wield weapon
                // Unequip any weapons from both arms
                unequip_if_weapon("arm_main");
                unequip_if_weapon("arm_off");
            }
            target = mainside ? "arm_main" : "arm_off";

            break;

        case Slot.body: target = "body"; break;

        case Slot.slingback: target = mainside ? "slingback_main" : "slingback_off"; break;

        case Slot.quiver: target = mainside ? "quiver_main" : "quiver_off"; break;

        case Slot.belt: target = "belt"; break;

        case Slot.belt_toolkit: target = "belt_toolkit"; break;

        case Slot.gauntlet: target = mainside ? "gauntlet_main" : "gauntlet_off"; break;

        case Slot.armbelt: target = mainside ? "armbelt_main" : "armbelt_off"; break;

        case Slot.greaves: target = mainside ? "greaves_main" : "greaves_off"; break;

        case Slot.helmet: target = "helmet"; break;

        case Slot.hipbelt: target = mainside ? "hipbelt_main" : "hipbelt_off"; break;

        default: throw new System.ArgumentException("Don't know how to equip " + equip_data.name + " to " + equip_data.slot);
        }

        unequip(target); _equip(equip_data, target);
    }
コード例 #2
0
    public void deliver_to(UnitActor other, string action)
    {
        switch (action)
        {
        case "marksmanship_double_tap":
            EquipData eq = actor.check_has_equipment_with_attributes("is_bow");

            if (eq != null)
            {
                List <EquipData> ammo = actor.use_ammo("arrow_iron");
                if (ammo.Count >= 1)
                {
                    if (is_strictly_hit(other, IS_RANGED, get_delta_range(eq, other)))
                    {
                        float damage = eq.base_damage + ammo[0].base_damage;

                        if (actor.has_tech("marksmanship_bow"))
                        {
                            damage = Mathf.Pow(damage, (DEX_CA + actor.stats.dexterity) / DEX_CB);
                        }

                        Debug.Log("Damage = " + damage);
                    }
                    else
                    {
                        Debug.Log("Missed!");
                    }
                }
                else
                {
                    throw new System.InvalidOperationException("Actor does not have available arrows");
                }
            }
            else
            {
                throw new System.InvalidOperationException("Actor does not have bow equipment");
            }
            break;
        }
    }