public bool can_target_item(Item_Data item_data) { if (can_repair && item_data.is_weapon) { Data_Weapon weapon = item_data.to_weapon; if (!weapon.is_staff() && weapon.Uses > 0 && item_data.Uses < weapon.Uses) { return(true); } } return(false); }
protected override bool is_valid_item(List <Item_Data> items, int i) { var item_data = items[i]; if (item_data.non_equipment || !item_data.is_weapon) { return(false); } TactileLibrary.Data_Weapon weapon = item_data.to_weapon; return(weapon.Ballista()); }
protected virtual bool can_counter(Game_Unit unit, Game_Unit target, TactileLibrary.Data_Weapon weapon, int distance) { // Skills: Old Swoop if (unit.old_swoop_activated) { return(false); } // Skills: Trample if (unit.trample_activated) { return(false); } return(target.can_counter(unit, weapon, distance)); }
protected override void set_images() { base.set_images(); Game_Unit unit = get_unit(); Combat_Map_Object target = Global.game_map.attackable_map_object(this.target); Game_Unit target_unit = null; bool is_target_unit = false; if (target.is_unit()) { is_target_unit = true; target_unit = (Game_Unit)target; } int distance = Global.game_map.combat_distance(unit.id, this.target); // Get weapon data TactileLibrary.Data_Weapon weapon1 = unit.actor.weapon, weapon2 = null; if (is_target_unit) { weapon2 = target_unit.actor.weapon; } List <int?> combat_stats = Combat.combat_stats(unit.id, this.target, distance); if (this.skills_visible) { for (int i = base.stat_rows * 2; i < stat_rows * 2; i++) { if (is_target_unit && combat_stats[(i % 2) * 4 + 3] == null && (i % 2 == 0 ? unit.shown_skill_rate(target_unit) : target_unit.shown_skill_rate(unit)) == null && (i % 2 == 0 ? unit : target_unit).has_any_mastery() != null) { Mastery_Gauge gauge = new Mastery_Gauge((i % 2 == 0 ? unit : target_unit).any_mastery_charge_percent()); gauge.height = 4; Stats.Add(gauge); gauge.draw_offset = new Vector2( 48 + 4 - (48 * (i % 2)), 0 + ((i / 2 + 1) * LINE_HEIGHT)); } else { RightAdjustedText text = new RightAdjustedText(); Stats.Add(text); text.draw_offset = new Vector2(68 - (48 * (i % 2)), 4 + ((i / 2 + 1) * LINE_HEIGHT)); text.SetFont(Config.UI_FONT, Global.Content, "Blue"); text.text = "0"; } } // Sets first units's stats // // Skill if (!(is_target_unit && combat_stats[3] == null && unit.shown_skill_rate(target_unit) == null && unit.has_any_mastery() != null)) { ((RightAdjustedText)Stats[base.stat_rows * 2]).text = combat_stats[3] == null ? "--" : combat_stats[3].ToString(); } // Sets second units's stats // if (!is_target_unit || !(combat_stats[7] == null && target_unit.shown_skill_rate(unit) == null && target_unit.has_any_mastery() != null)) { // Skill if (is_target_unit && can_counter(unit, target_unit, weapon1, distance)) { ((RightAdjustedText)Stats[base.stat_rows * 2 + 1]).text = combat_stats[7] == null ? "--" : combat_stats[7].ToString(); } else { ((RightAdjustedText)Stats[base.stat_rows * 2 + 1]).text = "--"; } } } for (int i = 0; i < 4; i++) { RightAdjustedText text = new RightAdjustedText(); Stats.Add(text); text.offset = new Vector2(-(69 - (48 * (i / 2))), -(5 + ((i % 2 + 1) * (LINE_HEIGHT / 2)) + ((Window.rows - 1) * LINE_HEIGHT))); text.SetFont(Config.UI_FONT + "S", Global.Content, "Blue", Config.UI_FONT); text.text = "--"; } if (is_target_unit) { // Terrain def bool magic2 = weapon2 == null ? false : target_unit.check_magic_attack(weapon2, distance); var def = magic2 ? unit.terrain_res_bonus(target_unit) : unit.terrain_def_bonus(target_unit); ((RightAdjustedText)Stats[stat_rows * 2]).text = def.IsNothing ? "--" : def.ToString(); // Terrain avo var avo = unit.terrain_avo_bonus(target_unit, magic2); ((RightAdjustedText)Stats[stat_rows * 2 + 1]).text = avo.IsNothing ? "--" : avo.ToString(); } if (is_target_unit) { // Terrain def bool magic1 = unit.check_magic_attack(weapon1, distance); var def = magic1 ? target_unit.terrain_res_bonus(unit) : target_unit.terrain_def_bonus(unit); ((RightAdjustedText)Stats[stat_rows * 2 + 2]).text = def.IsNothing ? "--" : def.ToString(); // Terrain avo var avo = target_unit.terrain_avo_bonus(unit, magic1); ((RightAdjustedText)Stats[stat_rows * 2 + 3]).text = avo.IsNothing ? "--" : avo.ToString(); } refresh(); }
protected override void set_images() { Icon1.flash = false; Icon2.flash = false; Mult1.value = 0; Mult2.value = 0; WTA1.set_effectiveness(1); WTA2.set_effectiveness(1); Game_Unit unit = get_unit(); Game_Actor actor1 = unit.actor; Combat_Map_Object target = Global.game_map.attackable_map_object(this.target); Game_Unit target_unit = null; Game_Actor actor2 = null; bool is_target_unit = false; if (target.is_unit()) { is_target_unit = true; target_unit = (Game_Unit)target; actor2 = target_unit.actor; Window.team2 = target_unit.team; } else { Window.team2 = target.team; } int distance = combat_distance(unit.id, this.target); // Get weapon data TactileLibrary.Data_Weapon weapon1 = actor1.weapon, weapon2 = null; if (is_target_unit) { weapon2 = actor2.weapon; } // Weapon triangle arrows WTA1.value = 0; WTA2.value = 0; WeaponTriangle tri = WeaponTriangle.Nothing; if (is_target_unit) { tri = Combat.weapon_triangle(unit, target_unit, weapon1, weapon2, distance); } if (tri != WeaponTriangle.Nothing) { WTA1.value = tri; if (weapon2 != null) { WTA2.value = Combat.reverse_wta(tri); } } List <int?> combat_stats = get_combat_stats(unit.id, this.target, distance); Stats = new List <Sprite>(); for (int i = 0; i < stat_rows * 2; i++) { RightAdjustedText text = new RightAdjustedText(); Stats.Add(text); text.draw_offset = new Vector2(68 - (48 * (i / 4)), 4 + ((i % 4 + 1) * LINE_HEIGHT)); text.SetFont(Config.UI_FONT, Global.Content, "Blue"); text.text = "0"; } // Sets first units's stats // Name1.draw_offset = new Vector2(44, 4); Name1.text = actor1.name; Name1.offset = new Vector2(Name1.text_width / 2, 0); // Multiplier Mult1.value = Mult1.get_multi(unit, target, weapon1, distance); // Icon Icon1.index = weapon1.Image_Index; Icon1.texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + weapon1.Image_Name); if (weapon1.effective_multiplier(unit, target_unit) > 1) { Icon1.flash = true; } float effectiveness = weapon1.effective_multiplier(unit, target_unit, false); WTA1.set_effectiveness((int)effectiveness, is_target_unit && target_unit.halve_effectiveness()); // Hp if (actor1.hp >= Math.Pow(10, Global.BattleSceneConfig.StatusHpCounterValues)) { ((RightAdjustedText)Stats[0]).text = "--"; } else { ((RightAdjustedText)Stats[0]).text = actor1.hp.ToString(); } // Dmg ((RightAdjustedText)Stats[1]).text = combat_stats[1].ToString(); // Hit if (combat_stats[0] >= 100) { ((RightAdjustedText)Stats[2]).SetFont("Blue_100", Global.Content); } ((RightAdjustedText)Stats[2]).text = combat_stats[0].ToString(); // Crt if (combat_stats[2] >= 100) { ((RightAdjustedText)Stats[3]).SetFont("Blue_100", Global.Content); } ((RightAdjustedText)Stats[3]).text = combat_stats[2].ToString(); // Sets second units's stats // string name2 = is_target_unit ? actor2.name : target.name; Name2.draw_offset = new Vector2(28, 4 + (Window.rows + 1) * LINE_HEIGHT); Name2.offset = new Vector2(Font_Data.text_width(name2, Config.UI_FONT) / 2, 0); Name2.text = name2; // Icon if (weapon2 != null) { Target_Weapon.text = weapon2.Name; Target_Weapon.draw_offset = new Vector2( 32 - Target_Weapon.text_width / 2, 4 + (Window.rows + 2) * LINE_HEIGHT); Icon2.index = weapon2.Image_Index; Icon2.texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + weapon2.Image_Name); if (weapon2.effective_multiplier(target_unit, unit) > 1) { Icon2.flash = true; } effectiveness = weapon2.effective_multiplier(target_unit, unit, false); WTA2.set_effectiveness((int)effectiveness, unit.halve_effectiveness()); } else { Target_Weapon.draw_offset = new Vector2( 32 - Font_Data.text_width("---", Config.UI_FONT) / 2, 4 + (Window.rows + 2) * LINE_HEIGHT); Target_Weapon.text = "---"; Icon2.texture = null; } // Hp //int target_hp = is_target_unit ? actor2.hp : ((Destroyable_Object)target).hp; //Debug if (target.hp >= Math.Pow(10, Global.BattleSceneConfig.StatusHpCounterValues)) { ((RightAdjustedText)Stats[4]).text = "--"; } else { ((RightAdjustedText)Stats[4]).text = target.hp.ToString(); } if (is_target_unit && can_counter(unit, target_unit, weapon1, distance)) { // Multiplier Mult2.value = Mult2.get_multi(target_unit, unit, weapon2, distance); // Dmg ((RightAdjustedText)Stats[5]).text = combat_stats[5].ToString(); // Hit if (combat_stats[4] >= 100) { ((RightAdjustedText)Stats[6]).SetFont("Blue_100", Global.Content); } ((RightAdjustedText)Stats[6]).text = combat_stats[4].ToString(); // Crt if (combat_stats[6] >= 100) { ((RightAdjustedText)Stats[7]).SetFont("Blue_100", Global.Content); } ((RightAdjustedText)Stats[7]).text = combat_stats[6].ToString(); } else { ((RightAdjustedText)Stats[5]).text = "--"; ((RightAdjustedText)Stats[6]).text = "--"; ((RightAdjustedText)Stats[7]).text = "--"; } refresh(); }
public Data_Weapon(Data_Weapon weapon) { CopyFrom(weapon); }