public void set_image(Game_Unit unit, Game_Unit target, int i) { TactileLibrary.Item_Data item_data = target.actor.items[i]; if (item_data.non_equipment) { Icon.texture = null; Name.text = ""; Uses.text = ""; Slash.text = ""; Use_Max.text = ""; } else { bool can_steal = unit.can_steal_item(target, i); TactileLibrary.Data_Equipment item = item_data.to_equipment; // Icon Icon.texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + item.Image_Name); Icon.index = item.Image_Index; // Name Name.text = item.Name; // Uses Uses.text = item_data.Uses < 0 ? "--" : item_data.Uses.ToString(); Slash.text = "/"; Use_Max.text = item.Uses < 0 ? "--" : item.Uses.ToString(); set_text_color(can_steal); } }
protected void color_text(Game_Unit unit, TactileLibrary.Item_Data item_data, List <string> strs) { for (int i = 0; i < num_items(); i++) { string color = "Green"; // Equip if (Index_Redirect[i] == 0 && !unit.actor.is_equippable(Global.data_weapons[item_data.Id])) { color = "Grey"; } // Use else if (Index_Redirect[i] == 1) { if (Combat.can_use_item(unit, item_data.Id, item_data.is_weapon)) { color = "White"; } else { color = "Grey"; } } // Discard else if (Index_Redirect[i] == 3 && !Can_Discard) { color = "Grey"; } Items[i].set_text_color(color); } }
public void give() { TactileLibrary.Item_Data item_data = actor.items[Item_Window.index]; if (!actor.can_give(item_data)) { Global.game_system.play_se(System_Sounds.Buzzer); return; } Global.game_battalions.add_item_to_convoy(actor.items[Item_Window.index]); bool giving_equipped = Item_Window.index == actor.equipped - 1; actor.discard_item(Item_Window.index); // If can't give anymore if (!can_give) { Global.game_system.play_se(System_Sounds.Cancel); cancel_trading(); } else { Global.game_system.play_se(System_Sounds.Confirm); } Traded = true; if (Item_Window.index < Item_Window.equipped || Item_Window.equipped == 0) { actor.setup_items(false); Item_Window.refresh_equipped_tag(); } refresh(); item_window_index_changed(); // Add jumping to the correct page and probably jumping to the correct line for the item here //Debug? Supply_Window.jump_to(item_data); }
public void give() { TactileLibrary.Item_Data item_data = actor.items[Item_Window.index]; if (!can_give || !actor.can_give(item_data)) { Global.game_system.play_se(System_Sounds.Buzzer); return; } Global.game_battalions.add_item_to_convoy(actor.items[Item_Window.index]); actor.discard_item(Item_Window.index); if (can_give) { Global.game_system.play_se(System_Sounds.Confirm); } else { Global.game_system.play_se(System_Sounds.Cancel); } Traded = true; refresh(); item_window_index_changed(); // Add jumping to the correct page and probably jumping to the correct line for the item here //Debug? Supply_Window.jump_to(item_data); if (can_give) { Item_Window.active = true; } else { switch_giving(); } }
public Siege_Engine(int id, Vector2 loc, TactileLibrary.Item_Data item) { Id = id; force_loc(loc); Item = item; Facing = 2; init_sprites(); }
public void read(BinaryReader reader) { Id = reader.ReadInt32(); Loc = Loc.read(reader); Real_Loc = Real_Loc.read(reader); Item = TactileLibrary.Item_Data.read(reader); State = (Siege_Engine_State)reader.ReadByte(); }
public Character_Data(int numItems, int numWLvls) { WLvls = new int[numWLvls - 1]; Items = new Item_Data[numItems]; for (int i = 0; i < Items.Length; i++) { Items[i] = new TactileLibrary.Item_Data(); } }
public static TactileLibrary.Item_Data[] read(this TactileLibrary.Item_Data[] ary, BinaryReader reader) { TactileLibrary.Item_Data[] result = new TactileLibrary.Item_Data[reader.ReadInt32()]; for (int i = 0; i < result.GetLength(0); i++) { result[i] = TactileLibrary.Item_Data.read(reader); } return(result); }
protected bool update_aoe_cleanup_actions(Game_Unit Battler_1) { switch (Cleanup_Action[0][0]) { case (int)Cleanup_Actions.Item_Gain: switch (Combat_Timer) { case 0: Combat_Timer++; Game_Unit item_receiver = Cleanup_Action[0][1] == 1 ? Battler_1 : Units[Aoe_Targets[Cleanup_Action[0][2] * -1]]; Game_Unit item_giver = Cleanup_Action[0][1] == 1 ? Units[Aoe_Targets[Cleanup_Action[0][2]]] : Battler_1; if (item_receiver.can_acquire_drops) { Global.game_system.play_se(System_Sounds.Gain); TactileLibrary.Item_Data item_data = item_giver.actor.drop_item(); if (Constants.Gameplay.REPAIR_DROPPED_ITEM) { item_data.repair(); } item_receiver.actor.gain_item(item_data); get_scene_map().set_item_popup(item_data, 113); if (item_receiver.actor.too_many_items) { Global.game_temp.menu_call = true; Global.game_temp.discard_menu_call = true; Global.game_system.Discarder_Id = item_receiver.id; } } else { Combat_Timer = 0; Cleanup_Action.RemoveAt(0); return(false); } break; case 1: if (!Global.game_temp.menu_call && !Global.game_state.is_menuing && !get_scene_map().is_map_popup_active()) { Combat_Timer++; } break; case 21: Cleanup_Action.RemoveAt(0); Combat_Timer = 0; break; default: Combat_Timer++; break; } return(true); } return(update_cleanup_actions(Battler_1, null)); }
public override void set_image(Game_Actor actor, TactileLibrary.Item_Data item_data) { if (item_data.non_equipment) { Icon.texture = null; Name.text = "Nothing"; change_text_color("Grey"); Uses.text = ""; } else { base.set_image(actor, item_data); } }
internal void refresh_stacked_items( List <SupplyItem> supplies, Game_Actor actor, List <int> itemCounts, bool sameUses) { var items = new List <Status_Item>(); for (int i = 0; i < supplies.Count; i++) { TactileLibrary.Item_Data item_data; var supply_item = supplies[i].get_item(); if (sameUses) { item_data = supply_item; } else { item_data = new TactileLibrary.Item_Data(supply_item.Type, supply_item.Id); } Status_Item item_listing = new Convoy_Item(); if (supplies[i].Convoy) { item_listing = new Convoy_Item(); (item_listing as Convoy_Item).set_image(actor, item_data, itemCounts[i]); } else { item_listing = new Convoy_Item(); //Debug (item_listing as Convoy_Item).set_image(actor, item_data, 0); //item_listing = new Status_Item(); //item_listing.set_image(actor, item_data); } //// If the item is a weapon and can't be equipped, color it grey // This should already be handled though //Yeti //if (item_data.is_weapon && !actor.is_equippable(Global.data_weapons[item_data.Id])) // item_listing.change_text_color("Grey"); items.Add(item_listing); } if (items.Count == 0) { items.Add(new ConvoyItemNothing()); } SupplyList = supplies; ConvoyItems = items; set_items(null); refresh_face(); }
public Window_Item_Options(Game_Unit unit, bool can_trade, Vector2 loc, int item_index, bool equipped) { List <string> strs = new List <string>(); TactileLibrary.Item_Data item_data = unit.actor.items[item_index]; // Weapon if (item_data.is_weapon) { if (unit.actor.has_staves_only() || !Global.data_weapons[item_data.Id].is_staff()) { unequip = Global.ActorConfig.AllowUnequip && equipped; if (unequip) { strs.Add("Unequip"); } else { strs.Add("Equip"); } Index_Redirect.Add(0); } if (Combat.can_use_item(unit, item_data.Id, item_data.is_weapon)) //Debug { strs.Add("Use"); Index_Redirect.Add(1); } } // Item else { strs.Add("Use"); Index_Redirect.Add(1); } if (can_trade) { strs.Add("Trade"); Index_Redirect.Add(2); } if (!this.discard_option_blocked) { strs.Add("Discard"); Index_Redirect.Add(3); } Can_Discard = unit.actor.CanDiscard(item_index); initialize(loc, WIDTH, strs); Window_Img.small = true; color_text(unit, item_data, strs); }
internal void add_item(int turn, Game_Unit unit, TactileLibrary.Item_Data item_data) { Items.Add(new Item_Metrics(turn, unit, item_data)); }
protected void refresh_battle_stats(bool just_stats) { if (!just_stats) { foreach (Item_Icon_Sprite icon in Weapon_Icons) { icon.texture = null; } foreach (TextSprite name in Weapon_Names) { name.text = ""; } TactileLibrary.Data_Weapon weapon1 = null; TactileLibrary.Data_Weapon weapon2 = null; WTAs[0].value = 0; if (Global.scene.scene_type == "Scene_Dance" || Global.scene.scene_type == "Scene_Promotion") { int item_index = -1; if (Global.scene.scene_type == "Scene_Dance") { item_index = Global.game_state.dance_item; } else if (Global.scene.scene_type == "Scene_Promotion") { item_index = Global.game_state.item_used; } if (item_index > -1) { TactileLibrary.Item_Data item_data = battler_1.actor.items[item_index]; TactileLibrary.Data_Equipment item1 = item_data.to_equipment; Weapon_Icons[0].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + item1.Image_Name); Weapon_Icons[0].index = item1.Image_Index; Weapon_Names[0].offset.X = Font_Data.text_width(item1.full_name()) / 2; Weapon_Names[0].text = item1.full_name(); } if (battler_2 != null) { WTAs[1].value = 0; weapon2 = battler_2.actor.weapon; if (weapon2 != null) { Weapon_Icons[1].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + weapon2.Image_Name); Weapon_Icons[1].index = weapon2.Image_Index; Weapon_Names[1].offset.X = Font_Data.text_width(weapon2.full_name()) / 2; Weapon_Names[1].text = weapon2.full_name(); } } } else { weapon1 = battler_1.actor.weapon; Weapon_Icons[0].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + weapon1.Image_Name); Weapon_Icons[0].index = weapon1.Image_Index; if (!(Data is Staff_Data) || ((Staff_Data)Data).attack_staff) { Weapon_Icons[0].flash = weapon1.effective_multiplier(battler_1, battler_2) > 1; } Weapon_Names[0].offset.X = Font_Data.text_width(weapon1.full_name()) / 2; Weapon_Names[0].text = weapon1.full_name(); if (battler_2 != null) { WTAs[1].value = 0; weapon2 = battler_2.actor.weapon; if (weapon2 != null) { Weapon_Icons[1].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + weapon2.Image_Name); Weapon_Icons[1].index = weapon2.Image_Index; if (!(Data is Staff_Data) || ((Staff_Data)Data).attack_staff) { Weapon_Icons[1].flash = weapon2.effective_multiplier(battler_2, battler_1) > 1; } Weapon_Names[1].offset.X = Font_Data.text_width(weapon2.full_name()) / 2; Weapon_Names[1].text = weapon2.full_name(); // Attack Multiplier if (!weapon1.is_staff()) { } // Mults[1].value = Mults[1].get_multi(battler_2, battler_1, weapon2); //Debug } if (!weapon1.is_staff()) { // Weapon triangle arrows WeaponTriangle tri = Combat.weapon_triangle(battler_1, battler_2, weapon1, weapon2, Data.Distance); if (tri != WeaponTriangle.Nothing) { WTAs[0].value = tri; if (weapon2 != null) { WTAs[1].value = Combat.reverse_wta(tri); } } // Attack Multiplier //Mults[0].value = Mults[0].get_multi(battler_1, battler_2, weapon1); //Debug } } } } for (int i = 0; i < Stat_Imgs.Count; i++) { if (Stats[i] == null) { Stat_Imgs[i].text = "--"; } else if (Stats[i] < 0) { Stat_Imgs[i].text = "--"; } else { Stat_Imgs[i].text = Stats[i].ToString(); } } }
internal override void update() { if (Steal_Calling) { In_Steal = true; Steal_Calling = false; } if (In_Steal && get_scene_map() != null) { bool cont = false; while (!cont) { cont = true; switch (Steal_Phase) { case 0: switch (Steal_Timer) { case 0: if (Global.game_state.is_player_turn) { Global.scene.suspend(); } Stealer_Id = Global.game_system.Battler_1_Id; Steal_Target_Id = Global.game_system.Battler_2_Id; Stolen_Item = Global.game_system.Stolen_Item; Global.game_system.Battler_1_Id = -1; Global.game_system.Battler_2_Id = -1; Global.game_system.Stolen_Item = -1; Steal_Timer++; break; case 1: case 2: case 3: // Wait until support gain hearts are done if (Global.game_state.support_gain_active) { break; } if (Global.player.is_on_square) { Steal_Timer++; } break; case 4: if (!Scrolling) { stealer.battling = true; steal_target.battling = true; // Turns map sprites toward each other stealer.face(steal_target); stealer.frame = 0; steal_target.facing = 10 - stealer.facing; steal_target.frame = 0; Steal_Phase = 1; Steal_Action = 0; Steal_Timer = 0; } break; } break; // Animation case 1: switch (Steal_Action) { // Waits case 0: switch (Steal_Timer) { case 23: Steal_Action++; Steal_Timer = 0; break; default: Steal_Timer++; break; } break; // Stealer moves toward the target case 1: stealer.attack_move(steal_target); Steal_Action++; break; // Waits until stealer has moved case 2: if (!stealer.is_attack_moving()) { Steal_Action++; } break; // Stealer animates case 3: Global.Audio.play_se("Map Sounds", "Map_Step_FDragon"); stealer.wiggle(); Steal_Action++; break; // Waits case 4: if (!stealer.is_wiggle_moving()) { stealer.attack_move(steal_target, true); Steal_Action++; } break; // Waits case 5: if (!stealer.is_attack_moving()) { Steal_Action++; } break; // Waits case 6: switch (Steal_Timer) { case 47: Steal_Phase++; Steal_Action = 0; Steal_Timer = 0; break; default: Steal_Timer++; break; } break; } stealer.update_attack_graphics(); break; // Steal processing case 2: switch (Steal_Action) { case 0: if (Constants.Gameplay.CANCEL_GREEN_DROP_ON_ANY_STEAL) { steal_target.drops_item = false; // which way are we going on this //Debug } else { // If the stolen item is the green drop, cancels green drop status if (Stolen_Item == steal_target.actor.num_items - 1) { steal_target.drops_item = false; } } TactileLibrary.Item_Data stolen_item = steal_target.actor.drop_item(Stolen_Item); stealer.actor.gain_item(stolen_item); if (!stealer.is_player_allied) { Global.game_system.play_se(System_Sounds.Loss); get_scene_map().set_item_stolen_popup(stolen_item, 113); } else { Global.game_system.play_se(System_Sounds.Gain); get_scene_map().set_item_steal_popup(stolen_item, 113); } if (stealer.actor.too_many_items && stealer.is_active_player_team) //Multi { Global.game_temp.menu_call = true; Global.game_temp.discard_menu_call = true; Global.game_system.Discarder_Id = stealer.id; } Steal_Action++; break; case 1: if (!Global.game_temp.menu_call && !Global.game_state.is_menuing && !get_scene_map().is_map_popup_active()) { Steal_Action++; } break; case 2: switch (Steal_Timer) { case 18: stealer.actor.staff_fix(); Steal_Phase++; Steal_Action = 0; Steal_Timer = 0; break; default: Steal_Timer++; break; } break; } break; // Exp gain case 3: switch (Steal_Action) { case 0: switch (Steal_Timer) { case 0: if (stealer.allowed_to_gain_exp() && stealer.actor.can_level()) { int exp = (Constants.Combat.STEAL_EXP > 0 ? Math.Min(Constants.Combat.STEAL_EXP, stealer.actor.exp_gain_possible()) : Math.Max(Constants.Combat.STEAL_EXP, -stealer.actor.exp_loss_possible())); exp = steal_target.cap_exp_given(exp); steal_target.add_exp_given(exp); if (exp != 0) { Global.game_state.exp_gauge_gain = exp; Global.game_system.chapter_exp_gain += exp; get_scene_map().create_exp_gauge(stealer.actor.exp); stealer.actor.exp += exp; Steal_Timer++; } else { Steal_Phase++; } } else { Steal_Phase++; } break; case 27: if (Global.game_state.process_exp_gain()) { Global.game_system.cancel_sound(); Steal_Timer++; } break; // Clears exp window, continues case 47: get_scene_map().clear_exp(); Steal_Timer++; break; case 78: if (stealer.actor.needed_levels > 0) { Steal_Action++; } else { Steal_Phase++; Steal_Action = 0; } Steal_Timer = 0; break; default: Steal_Timer++; break; } break; // Level up case 1: switch (Steal_Timer) { case 0: get_scene_map().level_up(Stealer_Id); Steal_Timer++; break; case 1: if (!get_scene_map().is_leveling_up()) { Steal_Timer++; } break; case 31: Steal_Phase++; Steal_Action = 0; Steal_Timer = 0; break; default: Steal_Timer++; break; } break; } break; // End default: switch (Steal_Timer) { case 0: if (stealer.cantoing && stealer.is_active_player_team) //Multi { Global.player.loc = stealer.loc; Global.player.instant_move = true; stealer.open_move_range(); } else { stealer.start_wait(false); } stealer.battling = false; steal_target.battling = false; stealer.queue_move_range_update(); steal_target.queue_move_range_update(); refresh_move_ranges(); Steal_Timer++; break; case 1: if (!Global.game_system.is_interpreter_running && !Global.scene.is_message_window_active) { Steal_Timer++; } break; case 2: Steal_Calling = false; In_Steal = false; Steal_Phase = 0; Steal_Action = 0; Steal_Timer = 0; Stealer_Id = -1; Steal_Target_Id = -1; Stolen_Item = -1; highlight_test(); Global.game_state.any_trigger_events(); break; } break; } } } }