Dictionary <string, bool> recalculate_actions() { Dictionary <string, bool> valid_actions = new Dictionary <string, bool>(actions); if (actor.check_has_equipment_with_attributes("is_melee") == null) { valid_actions["attack_melee"] = false; } //if (!actor.check_has_equipment_with_attributes(new List<string>() { { "is_bow" }, { "is_crossbow" } })) { if (actor.check_has_equipment_with_attributes("is_bow") == null && actor.check_has_equipment_with_attributes("is_crossbow") == null) { valid_actions["attack_bow"] = false; } if (actor.check_has_equipment_with_attributes("is_gunpowder") == null) { valid_actions["attack_firearm"] = false; } //if (!actor.check_has_equipment_with_attributes(new List<string>() { { "is_throwable"}, { "is_dedicated_throwable"} })) { if (actor.check_has_equipment_with_attributes("is_throwable") == null && actor.check_has_equipment_with_attributes("is_dedicated_throwable") == null) { valid_actions["throw"] = false; } return(valid_actions); }
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; } }