public virtual void refresh_info(Game_Actor actor, Data_Equipment item, int[] statValues, int[] baseStatValues) { // No item if (item == null) { Item_Description.text = ""; } // Weapon else if (is_weapon_highlighted(item)) { ShowingDescription = false; var type = (item as Data_Weapon).main_type(); Stats[0].text = statValues[0].ToString(); Stats[1].text = ((Data_Weapon)item).Crt < 0 ? "--" : statValues[1].ToString(); Stats[2].text = statValues[2].ToString(); Stats[3].text = statValues[3].ToString(); for (int i = 0; i < 4; i++) { Arrows[i].value = statValues[i] == baseStatValues[i] ? WeaponTriangle.Nothing : (statValues[i] > baseStatValues[i] ? WeaponTriangle.Advantage : WeaponTriangle.Disadvantage); } Type_Icon.index = type.IconIndex; } // Item else { ShowingDescription = true; Item_Description.text = ""; string[] desc_ary = item.Quick_Desc.Split('|'); for (int i = 0; i < desc_ary.Length; i++) { Item_Description.text += desc_ary[i] + "\n"; } } WTHelp.set_item(item); }
protected override void set_images() { Game_Unit unit = get_unit(); Game_Actor actor1 = unit.actor; Game_Unit target = Global.game_map.units[this.target]; Game_Actor actor2 = target.actor; // Get weapon data // This is dancing, why do we need weapons? //Yeti TactileLibrary.Data_Weapon weapon1 = actor1.weapon, weapon2 = actor2.weapon; // Map Sprite // Target_Sprite.texture = Scene_Map.get_team_map_sprite(target.team, target.map_sprite_name); Target_Sprite.offset = new Vector2( (Target_Sprite.texture.Width / Target_Sprite.frame_count) / 2, (Target_Sprite.texture.Height / Target_Sprite.facing_count) - 8); Target_Sprite.mirrored = target.has_flipped_map_sprite; // Sets Name // Name.offset = new Vector2(-(32), -(8)); Name.text = actor2.name; Stats = new List <TextSprite>(); for (int i = 0; i < 3; i++) { Stats.Add(i % 2 == 0 ? new RightAdjustedText() : new TextSprite()); Stats[i].offset = new Vector2(-24 - ((i / 2) * 24), -24); Stats[i].SetFont(Config.UI_FONT, Global.Content, (i % 2 == 0 ? "Blue" : "White")); } Stats[1].text = "/"; Stats[0].offset = new Vector2(-48, -24); Stats[1].offset = new Vector2(-48, -24); Stats[2].offset = new Vector2(-72, -24); // Hp Stats[0].text = actor2.hp.ToString(); // Max Hp Stats[2].text = actor2.maxhp.ToString(); refresh(); }
internal void update(Game_Unit unit) { Game_Actor actor = unit.actor; float hp_percent = (float)actor.hp / actor.maxhp; if (Hp_Percent != hp_percent || HpGaugesMode != Global.game_options.hp_gauges) { Hp_Percent = hp_percent; HpGaugesMode = Global.game_options.hp_gauges; float hue; // Simple mode if (HpGaugesMode == (int)Constants.Hp_Gauge_Modes.Basic) { hue = Hp_Percent * Config.SIMPLE_HPGAUGE_MAX_HUE; } // Advanced mode else { hue = (Math.Min(actor.hp, Global.ActorConfig.HpMax) / (float)Global.ActorConfig.HpMax) * Config.ADVANCED_HPGAUGE_MAX_HUE; } Hp_Hue = color_from_hue(hue); if (Hp_Percent > 0 && Hp_Percent < 1f / (WIDTH - 3)) { Hp_Percent = 1f / (WIDTH - 3); } } Team = unit.team; visible = !actor.is_full_hp() || Global.game_options.hp_gauges != (int)Constants.Hp_Gauge_Modes.Injured; }
protected virtual int sort_switch(Game_Actor actor_a, Game_Actor actor_b, int new_sort) { int value; switch ((Unit_Sort)new_sort) { case Unit_Sort.Name: if (Preparations) { bool deployed_a = PickUnits_Window.actor_deployed(actor_a.id); bool deployed_b = PickUnits_Window.actor_deployed(actor_b.id); if (deployed_a != deployed_b) { return(deployed_a ? -1 : 1); } } if (Global.battalion.actors.Contains(actor_a.id) && Global.battalion.actors.Contains(actor_b.id)) { value = Global.battalion.actors.IndexOf(actor_a.id) - Global.battalion.actors.IndexOf(actor_b.id); } else { value = actor_a.id - actor_b.id; } break; case Unit_Sort.Anim: value = actor_a.individual_animation - actor_b.individual_animation; break; default: value = 0; break; } return(value); }
internal LevelUpProcessor(Game_Actor actor) { Actor = actor; }
private int dmg_target(Game_Unit target) { Data_Weapon weapon = this.attacker_weapon; // Checks if weapon is magic bool magic_attack = attacker.check_magic_attack(weapon, Distance); bool imbue = (magic_attack && attacker.actor.power_type() == Power_Types.Strength); bool is_staff = weapon.is_staff(); Game_Actor actor2 = target.actor; Data_Weapon weapon2 = actor2.weapon; int total_damage, target_def; int actor_dmg, weapon_dmg, skill_dmg, support_dmg; // Staff if (is_staff) { actor_dmg = attacker.atk_pow(weapon, magic_attack); weapon_dmg = weapon.Mgt; skill_dmg = 0; attacker.dmg_staff_skill( ref skill_dmg, ref weapon_dmg, ref actor_dmg, target, magic_attack, Distance); support_dmg = support_bonus(Combat_Stat_Labels.Dmg); target_def = 0; } // Weapon else { var target_stats = this.target_stats(); target_def = magic_attack ? target_stats.res() : target_stats.def(); target_def = (weapon.Ignores_Def() ? target_def / 2 : target_def); if (weapon.Halves_HP()) { int total_weapon_damage = target_def + (int)Math.Ceiling(target.actor.hp / 2.0f); actor_dmg = (int)Math.Ceiling(total_weapon_damage / 2.0f); weapon_dmg = (int)Math.Floor(total_weapon_damage / 2.0f); } else { actor_dmg = weapon.Ignores_Pow() ? 0 : ((int)(attacker.atk_pow(weapon, magic_attack) * (imbue ? Constants.Combat.MAGIC_WEAPON_STR_RATE : 1))); weapon_dmg = (int)(weapon.Mgt * (imbue ? Constants.Combat.MAGIC_WEAPON_MGT_RATE : 1)); if (weapon.Ignores_Def()) { weapon_dmg += target_def; } } // Weapon triangle skill_dmg = 0; WeaponTriangle tri = Combat.weapon_triangle(attacker, target, weapon, weapon2, Distance); if (tri != WeaponTriangle.Nothing) { skill_dmg += Weapon_Triangle.DMG_BONUS * (tri == WeaponTriangle.Advantage ? 1 : -1) * Combat.weapon_triangle_mult(attacker, target, weapon, weapon2, Distance); } float effectiveness = weapon.effective_multiplier(attacker, target); skill_dmg += (int)((weapon_dmg + skill_dmg) * (effectiveness - 1)); support_dmg = support_bonus(Combat_Stat_Labels.Dmg); attacker.dmg_skill( ref skill_dmg, ref weapon_dmg, ref actor_dmg, ref support_dmg, ref target_def, weapon, target, weapon2, tri, magic_attack, Distance, effectiveness); } total_damage = actor_dmg + weapon_dmg + skill_dmg + support_dmg - target_def; int result = attacker.dmg_target_skill(target, weapon, Distance, Math.Max(0, total_damage)); return(result); }
private void RollSemifixedGrowths( int[] growthRates, IEnumerable <int> stats, List <int> randomStatOrder, int multiplier) { // Skip if no stats to process if (!stats.Any()) { return; } // Get totals float growthTotal = multiplier * stats .Select(x => growthRates[x] / (float)Game_Actor.GetStatRatio(x)) .Sum(); // Take the roll for each growth rate and get the difference var rolls = new List <Tuple <int, int> >(); foreach (int j in stats) { rolls.Add(Tuple.Create(j, Rolls[j] - (multiplier * growthRates[j]))); } // Sort by how far under the growth the roll was rolls.Sort(delegate(Tuple <int, int> a, Tuple <int, int> b) { int sortValue = a.Item2 - b.Item2; if (sortValue == 0) { return(randomStatOrder.IndexOf(b.Item1)); } return(sortValue); }); // Go through stats in the order they beat the rng by while (growthTotal > 0 && rolls.Any()) { int stat = rolls[0].Item1; rolls.RemoveAt(0); float value = 1 / (float)Game_Actor.GetStatRatio(stat); float statWorth = value * 100; // IF the remaining points to gain are worth more than the current stat, // automatically grant the point if (growthTotal >= statWorth) { StatGains[stat] += multiplier; growthTotal -= statWorth; } // Else roll for this stat, with the probability being the percentage // of a point remaining else { if (Global.game_system.get_rng() < growthTotal / value) { StatGains[stat] += multiplier; } growthTotal = 0; } } }
public PromotionProcessor(Game_Actor actor, int oldClassId) : base(actor) { OldClassId = oldClassId; SetLevelUpData(0); }
private void UseItem( ConfirmationMenu useConfirmMenu, ItemUseMenu useMenu, ItemRepairMenu repairMenu) { Game_Actor actor = useMenu.Actor; Data_Item item = useMenu.SelectedItemData.to_item; // Use -1 if nothing int inventoryTarget = -1; if (repairMenu != null) { inventoryTarget = repairMenu.SelectedItem; } // If promoting if (actor.PromotedBy(item)) { // If there are multiple promotion choices if (actor.PromotedBy(item) && actor.NeedsPromotionMenu) { Global.game_map.add_actor_unit(Constants.Team.PLAYER_TEAM, Config.OFF_MAP, actor.id, ""); var unit = Global.game_map.last_added_unit; var promotionChoiceMenu = new PromotionChoiceMenu(unit); promotionChoiceMenu.Selected += PromotionChoiceMenu_Selected; promotionChoiceMenu.Canceled += PromotionChoiceMenu_Canceled; promotionChoiceMenu.Closed += menu_Closed; promotionChoiceMenu.Confirmed += PromotionChoiceMenu_Confirmed; AddMenu(promotionChoiceMenu); var promotionMenuFadeIn = promotionChoiceMenu.FadeInMenu(false); promotionMenuFadeIn.Finished += menu_Closed; AddMenu(promotionMenuFadeIn); } else { Promote(useMenu); } } else { RemoveTopMenu(useConfirmMenu); if (repairMenu != null) { RemoveTopMenu(repairMenu); } Global.game_system.play_se(System_Sounds.Gain); Dictionary <Boosts, int> boosts = actor.item_boosts(item); // Apply item effect actor.item_effect(item, inventoryTarget); actor.recover_hp(); useMenu.UseItem(); useMenu.ShowWindow(); if (item.is_stat_booster() || item.is_growth_booster()) { useMenu.CreateStatsPopup(item, boosts); } else if (item.can_repair) { useMenu.CreateRepairPopup(inventoryTarget); } } }
protected virtual void set_hp(Game_Actor actor) { Hp.text = actor.maxhp.ToString(); }
public void set_images(Game_Actor actor) { Supports.set_images(actor); }
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(); }
internal void refresh(Game_Actor actor) { Text.text = ActorTextFormula(actor); stat_bonus(0); }
protected override void set_face(Game_Actor actor) { Face = new Status_Face(actor); Face.loc = new Vector2(48, 96); }
public StandardLevelUp(Game_Actor actor, int levelCount = 1) : base(actor, levelCount) { }
public LevelUpProcessor(Game_Actor actor, int levelCount = 1) { Actor = actor; SetLevelUpData(levelCount); }
public SemifixedLevelUp(Game_Actor actor, int levelCount = 1) : base(actor, levelCount) { }
protected override void set_images() { if (Mode != Staff_Target_Mode.Torch) { Game_Unit unit = get_unit(); Game_Actor actor1 = unit.actor; Game_Unit target = Global.game_map.units[this.target]; Game_Actor actor2 = target.actor; int distance = Global.game_map.combat_distance(unit.id, target.id); // Get weapon data TactileLibrary.Data_Weapon weapon1 = actor1.weapon, weapon2 = actor2.weapon; // Map Sprite // Target_Sprite.texture = Scene_Map.get_team_map_sprite(target.team, target.map_sprite_name); Target_Sprite.offset = new Vector2( (Target_Sprite.texture.Width / Target_Sprite.frame_count) / 2, (Target_Sprite.texture.Height / Target_Sprite.facing_count) - 8); Target_Sprite.mirrored = target.has_flipped_map_sprite; // Sets Name // Name.offset = new Vector2(-(32), -(8)); Name.text = actor2.name; var stats = new Calculations.Stats.CombatStats( unit.id, target.id, distance: distance); var target_stats = new Calculations.Stats.CombatStats( target.id, unit.id, distance: distance); Stats = new List <TextSprite>(); // Healing if (Mode == Staff_Target_Mode.Heal) { List <int> status_heal = unit.actor.weapon.healable_statuses(target); Window.height = status_heal.Count > 0 ? 64 : 48; for (int i = 0; i < 5; i++) { Stats.Add(i % 2 == 0 ? new RightAdjustedText() : new TextSprite()); Stats[i].offset = new Vector2(-(48 + ((i / 2) * 24)), -24); Stats[i].SetFont(Config.UI_FONT, Global.Content, (i % 2 == 0 ? "Blue" : "White")); } bool hp_restore = unit.actor.weapon.Heals(); if (hp_restore) { Stats[1].text = "-"; } Stats[3].text = "/"; if (hp_restore) { // Hp Stats[0].text = actor2.hp.ToString(); // New Hp Stats[2].text = Math.Min(actor2.hp + stats.dmg(), actor2.maxhp).ToString(); } else { // Hp Stats[2].text = actor2.hp.ToString(); } // Max Hp Stats[4].text = actor2.maxhp.ToString(); // Status Status_Icons.Clear(); StatLabels[1].text = ""; if (status_heal.Count > 0) { StatLabels[1].SetFont(Config.UI_FONT); StatLabels[1].text = "Cond"; for (int i = 0; i < status_heal.Count; i++) { Status_Icons.Add(new Status_Icon_Sprite()); Status_Icons[Status_Icons.Count - 1].texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/Statuses"); Status_Icons[Status_Icons.Count - 1].size = new Vector2(16, 16); Status_Icons[Status_Icons.Count - 1].offset = new Vector2(-(32 + (i * 16)), -40); Status_Icons[Status_Icons.Count - 1].index = Global.data_statuses[status_heal[i]].Image_Index; Status_Icons[Status_Icons.Count - 1].counter = actor2.state_turns_left(status_heal[i]); } } } // Status Inflict else if (Mode == Staff_Target_Mode.Status_Inflict) { for (int i = 0; i < 2; i++) { Stats.Add(new RightAdjustedText()); Stats[i].offset = new Vector2(-88, -(24 + i * 16)); Stats[i].SetFont(Config.UI_FONT, Global.Content, "Blue"); } // Hp Stats[0].text = target_stats.res().ToString(); // New Hp Stats[1].text = Math.Min(100, stats.hit()).ToString(); } // Barrier if (Mode == Staff_Target_Mode.Barrier) { for (int i = 0; i < 3; i++) { Stats.Add(i % 2 == 0 ? new RightAdjustedText() : new TextSprite()); Stats[i].offset = new Vector2(-(48 + ((i / 2) * 24)), -24); Stats[i].SetFont(Config.UI_FONT, Global.Content, (i % 2 == 0 ? "Blue" : "Yellow")); } Stats[1].text = "-"; // Res Stats[0].text = (actor2.stat(Stat_Labels.Res) + target.temporary_stat_buff(TactileLibrary.Buffs.Res)).ToString(); // New Res Stats[2].text = (actor2.stat(Stat_Labels.Res) + Constants.Combat.BARRIER_BONUS).ToString(); } refresh(); } }
public bool switch_unit(Game_Actor actor) { Unit_Window.actor_id = actor.id; return(switch_unit()); }
protected override void set_images() { if (Mode != Staff_Target_Mode.Torch) { Game_Unit unit = get_unit(); Game_Actor actor1 = unit.actor; Game_Unit target = Global.game_map.units[this.target]; Game_Actor actor2 = target.actor; // Map Sprite // Target_Sprite.texture = Scene_Map.get_team_map_sprite(target.team, target.map_sprite_name); Target_Sprite.offset = new Vector2( (Target_Sprite.texture.Width / Target_Sprite.frame_count) / 2, (Target_Sprite.texture.Height / Target_Sprite.facing_count) - 8); Target_Sprite.mirrored = target.has_flipped_map_sprite; Unit_Sprite.texture = Scene_Map.get_team_map_sprite(unit.team, unit.map_sprite_name); Unit_Sprite.offset = new Vector2( (Unit_Sprite.texture.Width / Unit_Sprite.frame_count) / 2, (Unit_Sprite.texture.Height / Unit_Sprite.facing_count) - 8); Unit_Sprite.mirrored = unit.has_flipped_map_sprite; // Sets Name // Name.offset = new Vector2(-(32), -(8)); Name.text = actor2.name; Unit_Name.offset = new Vector2(-(32), -(8 + 48)); Unit_Name.text = actor1.name; Stats = new List <TextSprite>(); // Healing if (Mode == Staff_Target_Mode.Heal) { for (int i = 0; i < 5; i++) { Stats.Add(i % 2 == 0 ? new RightAdjustedText() : new TextSprite()); Stats[i].offset = new Vector2(-(48 + ((i / 2) * 24)), -24); Stats[i].SetFont(Config.UI_FONT, Global.Content, (i % 2 == 0 ? "Blue" : "White")); } for (int i = 5; i < 10; i++) { Stats.Add(i % 2 == 1 ? new RightAdjustedText() : new TextSprite()); Stats[i].offset = new Vector2(-(48 + (((i - 5) / 2) * 24)), -72); Stats[i].SetFont(Config.UI_FONT, Global.Content, (i % 2 == 1 ? "Blue" : "White")); } int heal = unit.sacrifice_heal_amount(target); Stats[1].text = "-"; Stats[6].text = "-"; Stats[3].text = "/"; Stats[8].text = "/"; // Hp Stats[0].text = actor2.hp.ToString(); Stats[5].text = actor1.hp.ToString(); // New Hp Stats[2].text = (actor2.hp + heal).ToString(); Stats[7].text = (actor1.hp - heal).ToString(); // Max Hp Stats[4].text = actor2.maxhp.ToString(); Stats[9].text = actor1.maxhp.ToString(); // Status StatLabels[1].text = ""; StatLabels[3].text = ""; } refresh(); } }
public void set_images(Game_Actor actor, Game_Actor target = null) { Bonuses.set_images(null, actor); Bonuses.set_next_level_bonus(actor, target); }
public PreparationsStatsPanel(Game_Actor actor) : base(actor) { //Item_Description.loc = new Vector2(128, 48); //Item_Description.loc = // new Vector2(Config.WINDOW_WIDTH - 152, Config.WINDOW_HEIGHT - 56); }