// sub_648D9 internal static void CalcStatBonuses(Stat stat_index, Player player) { int stat_b = 0; int str_00_b = 0; int var_11 = 0x0FF; int stat_a = player.stats2[(int)stat_index].cur; int str_00_a = player.stats2.Str00.full; foreach (Item item in player.items) { if ((int)item.affect_3 > 0x80 && item.readied == true) { int var_12 = (int)item.affect_3 & 0x7F; if (stat_index == Stat.STR) { if (var_12 == 5) { switch ((int)item.affect_2) { case 0: stat_b = 18; str_00_b = 100; break; case 1: stat_b = 19; break; case 2: stat_b = 20; break; case 3: stat_b = 21; break; case 4: stat_b = 22; break; case 5: stat_b = 23; break; case 6: stat_b = 24; break; } } else if (var_12 == 8) { if (player.stats2.Str.cur < 18 && item.affect_2 == 0) { stat_b = (byte)(player.stats2.Str.cur + 1); str_00_b = 0; } } else if (var_12 == 13) { var_11 = 3; } max_strength(ref stat_a, stat_b, ref str_00_a, str_00_b); } else if (stat_index == Stat.CON) { if (var_12 == 6) { stat_a++; } else if (var_12 == 8 && player.stats2.Con.cur < 18 && (int)item.affect_2 == 4) { stat_a++; } } else if (stat_index == Stat.INT) { if (var_12 == 8) { if (player.stats2.Int.cur < 0x18 && (int)item.affect_2 == 1) { stat_a++; } } else if (var_12 == 12) { var_11 = 7; } else if (var_12 == 13) { var_11 = 3; } } else if (stat_index == Stat.WIS) { if (var_12 == 8 && (int)item.affect_2 == 2 && player.stats2.Wis.cur < 18) { stat_a++; } } else if (stat_index == Stat.DEX) { if (var_12 == 2) { if (player.stats2.Dex.cur >= 0 && player.stats2.Dex.cur <= 6) { stat_a += 4; } else if (player.stats2.Dex.cur >= 7 && player.stats2.Dex.cur <= 13) { stat_a += 2; } else { stat_a++; } } else if (var_12 == 8) { if (player.stats2.Dex.cur < 18 && (int)item.affect_2 == 3) { stat_a++; } } else if (var_12 == 10) { stat_a -= 2; } } else if (stat_index == Stat.CHA) { if (var_12 == 6) { stat_a -= 1; } else if (var_12 == 8 && player.stats2.Cha.cur < 18 && (int)item.affect_2 == 5) { stat_a += 1; } } } } if (stat_index == Stat.STR) { Affect affect_ptr; if (ovr025.FindAffect(out affect_ptr, Affects.strength, player) == true) { decode_strength(out str_00_b, out stat_b, affect_ptr); if (stat_a <= 18 && str_00_a < 100) { stat_b += stat_a; if (stat_b > 18) { if (player.fighter_lvl > 0 || player.fighter_old_lvl > 0 || player.paladin_lvl > 0 || player.paladin_old_lvl > 0 || player.ranger_lvl > 0 || player.ranger_old_lvl > 0) { str_00_b = (byte)(player.stats2.Str00.cur + ((stat_b - 18) * 10)); if (str_00_b > 100) { str_00_b = 100; } stat_b = 18; } else { stat_b = 18; } } } max_strength(ref stat_a, stat_b, ref str_00_a, str_00_b); } if (ovr025.FindAffect(out affect_ptr, Affects.strength_spell, player) == true) { decode_strength(out str_00_b, out stat_b, affect_ptr); max_strength(ref stat_a, stat_b, ref str_00_a, str_00_b); } if (ovr025.FindAffect(out affect_ptr, Affects.enlarge, player) == true) { decode_strength(out str_00_b, out stat_b, affect_ptr); max_strength(ref stat_a, stat_b, ref str_00_a, str_00_b); } if (var_11 != 0xff) { player.stats2.Str.full = var_11; player.stats2.Str00.cur = 0; } else { player.stats2.Str.full = stat_a; player.stats2.Str00.cur = str_00_a; } } else if (stat_index == Stat.CON) { int hitPointBonus = 0; byte classCount = 0; byte orig_max_hp = player.hit_point_max; player.hit_point_max = player.hit_point_rolled; for (SkillType classId = SkillType.Cleric; classId <= SkillType.Monk; classId++) { byte classLvl = player.ClassLevelsOld[(int)classId]; if (classLvl > 0) { hitPointBonus += ConHitPointBonus(classLvl, classId, stat_a, player); } classLvl = player.ClassLevel[(int)classId]; if (classLvl > 0) { classCount++; } if (gbl.max_class_hit_dice[(int)classId] < classLvl) { classLvl = gbl.max_class_hit_dice[(int)classId]; } if (classLvl > player.multiclassLevel) { classLvl -= player.multiclassLevel; hitPointBonus += ConHitPointBonus(classLvl, classId, stat_a, player); } } hitPointBonus /= classCount; player.hit_point_max += (byte)hitPointBonus; if (player.hit_point_max > orig_max_hp) { player.hit_point_current += (byte)(player.hit_point_max - orig_max_hp); } else if (player.hit_point_max < orig_max_hp) { if (player.hit_point_current > (orig_max_hp - player.hit_point_max)) { player.hit_point_current -= (byte)(orig_max_hp - player.hit_point_max); } else { player.hit_point_current = 0; } } player.stats2.Con.full = stat_a; if (player.stats2.Con.full > 20) { if (player.HasAffect(Affects.highConRegen) == true) { add_affect(false, 0xff, 0x3c, Affects.highConRegen, player); } } else { remove_affect(null, Affects.highConRegen, player); } } else if (stat_index == Stat.INT) { if (player.HasAffect(Affects.feeblemind) == true && var_11 > 7) { var_11 = 3; } if (var_11 != 0xff) { player.stats2.Int.full = var_11; } else { player.stats2.Int.full = stat_a; } } else if (stat_index == Stat.WIS) { if (player.HasAffect(Affects.feeblemind) == true && var_11 > 7) { var_11 = 3; } if (var_11 != 0xff) { player.stats2.Wis.full = var_11; } else { player.stats2.Wis.full = stat_a; } } else if (stat_index == Stat.DEX) { if (var_11 != 0xff) { player.stats2.Dex.full = var_11; } else { player.stats2.Dex.full = stat_a; } } else if (stat_index == Stat.CHA) { Affect affect; if (ovr025.FindAffect(out affect, Affects.friends, player) == true) { stat_a = affect.affect_data; } player.stats2.Cha.full = stat_a; } }
internal static void in_poison_cloud(byte arg_0, Player player) { if (player.in_combat == true) { bool isPoisonousCloud; bool isNoxiouxCloud; int dummyGroundTile; int dummyPlayerIndex; ovr033.getGroundInformation(out isPoisonousCloud, out isNoxiouxCloud, out dummyGroundTile, out dummyPlayerIndex, 8, player); Affect affect; if (isNoxiouxCloud && arg_0 != 0 && ovr025.FindAffect(out affect, Affects.helpless, player) == false && ovr025.FindAffect(out affect, Affects.animate_dead, player) == false && ovr025.FindAffect(out affect, Affects.affect_6f, player) == false && ovr025.FindAffect(out affect, Affects.affect_7d, player) == false) { bool save_passed = RollSavingThrow(0, 0, player); if (save_passed == true) { Player tmp_player_ptr = gbl.SelectedPlayer; gbl.SelectedPlayer = sub_63D03(gbl.unk_18AEA, 4, gbl.NoxiousCloud, ovr033.PlayerMapPos(player)); is_unaffected("starts to cough", save_passed, 0, false, 0xff, 1, Affects.stinking_cloud, player); if (player.HasAffect(Affects.stinking_cloud) == true) { ovr013.CallAffectTable(Effect.Add, affect, player, Affects.stinking_cloud); } gbl.SelectedPlayer = tmp_player_ptr; } else { Player tmp_player_ptr = gbl.SelectedPlayer; gbl.SelectedPlayer = sub_63D03(gbl.unk_18AEA, 4, gbl.NoxiousCloud, ovr033.PlayerMapPos(player)); is_unaffected("chokes and gags from nausea", save_passed, 0, false, 0xff, (ushort)(roll_dice(4, 1) + 1), Affects.helpless, player); if (ovr025.FindAffect(out affect, Affects.helpless, player) == true) { ovr013.CallAffectTable(Effect.Add, affect, player, Affects.helpless); } gbl.SelectedPlayer = tmp_player_ptr; } } if (isPoisonousCloud == true && player.in_combat == true) { if (player.HitDice >= 0 && player.HitDice <= 4) { ovr025.DisplayPlayerStatusString(false, 10, "is Poisoned", player); seg041.GameDelay(); add_affect(false, 0xff, 0, Affects.minor_globe_of_invulnerability, player); KillPlayer("is killed", Status.dead, player); } else if (player.HitDice == 5) { if (RollSavingThrow(-4, 0, player) == false) { ovr025.DisplayPlayerStatusString(false, 10, "is Poisoned", player); seg041.GameDelay(); add_affect(false, 0xff, 0, Affects.poisoned, player); KillPlayer("is killed", Status.dead, player); } } else if (player.HitDice == 6) { if (RollSavingThrow(0, 0, player) == false) { ovr025.DisplayPlayerStatusString(false, 10, "is Poisoned", player); seg041.GameDelay(); add_affect(false, 0xff, 0, Affects.poisoned, player); KillPlayer("is killed", Status.dead, player); } } } } }
/* spell_stone */ internal static void AffectParalizingGaze(Effect arg_0, object param, Player player) { player.actions.target = null; gbl.byte_1DA70 = gbl.SpellCastFunction(QuickFight.True, (int)Spells.spell_41); if (player.actions.target != null) { gbl.spell_target = player.actions.target; ovr025.DisplayPlayerStatusString(false, 10, "gazes...", player); ovr025.load_missile_icons(0x12); ovr025.draw_missile_attack(0x2d, 4, ovr033.PlayerMapPos(gbl.spell_target), ovr033.PlayerMapPos(player)); if (player.HasAffect(Affects.affect_7f) == true) { Item item = gbl.spell_target.items.Find(i => i.readied && (i.namenum1 == 0x76 || i.namenum2 == 0x76 || i.namenum3 == 0x76)); if (item != null) { ovr025.DisplayPlayerStatusString(false, 12, "reflects it!", gbl.spell_target); ovr025.draw_missile_attack(0x2d, 4, ovr033.PlayerMapPos(player), ovr033.PlayerMapPos(gbl.spell_target)); gbl.spell_target = player; } } if (ovr024.RollSavingThrow(0, SaveVerseType.type1, gbl.spell_target) == false) { ovr024.KillPlayer("is Stoned", Status.stoned, gbl.spell_target); } } }
// sub_645AB internal static void RemoveCombatAffects(Player player) { Affects[] table = { Affects.faerie_fire, Affects.charm_person, Affects.reduce, Affects.silence_15_radius, Affects.spiritual_hammer, Affects.stinking_cloud, Affects.helpless, Affects.animate_dead, Affects.snake_charm, Affects.paralyze, Affects.sleep, Affects.clear_movement, Affects.regenerate, Affects.affect_5F, Affects.regen_3_hp, Affects.entangle, Affects.affect_89, Affects.affect_8b, Affects.owlbear_hug_round_attack }; System.Array.ForEach(table, affect => remove_affect(null, affect, player)); if (player.HasAffect(Affects.berserk) == true && player.control_morale == Control.PC_Berzerk) { player.combat_team = CombatTeam.Ours; } }
/* sub_575F0 */ internal static bool CanCastHeal(Player player) { return (player.SkillLevel(SkillType.Paladin) > 0 && gbl.game_state != GameState.Combat && player.health_status == Status.okey && player.HasAffect(Affects.paladinDailyHealCast) == false); }
/* sub_577EC */ internal static void PaladinCureDisease(Player player) { ovr025.LoadPic(); Player target = gbl.TeamList[0]; ovr025.selectAPlayer(ref target, true, "Cure whom? "); if (target == null) { playerDisplayFull(gbl.SelectedPlayer); } else { bool is_diseased = System.Array.Exists(paladinCureableDiseases, affect => target.HasAffect(affect)); char input = 'Y'; if (is_diseased == false) { ovr025.DisplayPlayerStatusString(false, 0, "is not diseased", target); input = ovr027.yes_no(gbl.defaultMenuColors, "cure anyway: "); ovr025.ClearPlayerTextArea(); } if (input == 'Y') { gbl.cureSpell = true; System.Array.ForEach(paladinCureableDiseases, affect => ovr024.remove_affect(null, affect, target)); gbl.cureSpell = false; if (player.paladinCuresLeft > 0) { player.paladinCuresLeft--; } if (player.HasAffect(Affects.paladinDailyCureRefresh) == false) { ovr024.add_affect(true, 0, 0x2760, Affects.paladinDailyCureRefresh, player); } ovr025.string_print01(target.name + " is cured"); } playerDisplayFull(gbl.SelectedPlayer); } }
{2, 2, 0, 4, 4, 4} /*, {4, 2, 6, 6}*/ }; /* actual from seg600:02BD - seg600:02F8 */ #endregion Fields #region Methods // sub_3573B internal static bool CanMove(out bool groundClear, int baseDirecction, int dirStep, Player player) { groundClear = false; bool canMove = false; int var_6 = data_2B8[player.actions.field_15, dirStep - 1]; int playerDirection = (baseDirecction + var_6) % 8; int groundTile; int playerIndex; bool isPoisonousCloud; bool isNoxiousCloud; ovr033.getGroundInformation(out isPoisonousCloud, out isNoxiousCloud, out groundTile, out playerIndex, playerDirection, player); if (groundTile == 0) { groundClear = true; } else { if (gbl.BackGroundTiles[groundTile].move_cost == 0xff) { return false; } int move_cost = gbl.BackGroundTiles[groundTile].move_cost; if ((playerDirection & 1) != 0) { move_cost *= 3; } else { move_cost *= 2; } if (playerIndex == 0 && move_cost < player.actions.move) { if (isNoxiousCloud == true && player.HasAffect(Affects.animate_dead) == false && player.HasAffect(Affects.stinking_cloud) == false && player.HasAffect(Affects.affect_6f) == false && player.HasAffect(Affects.affect_7d) == false && player.HasAffect(Affects.protect_magic) == false && player.HasAffect(Affects.minor_globe_of_invulnerability) == false && player.actions.fleeing == false) { if (ovr024.RollSavingThrow(0, 0, player) == false) { move_cost = player.actions.move + 1; } } if (isPoisonousCloud == true && player.HitDice < 7 && player.HasAffect(Affects.protect_magic) == false && player.HasAffect(Affects.affect_6f) == false && player.HasAffect(Affects.affect_85) == false && player.HasAffect(Affects.affect_7d) == false && player.actions.fleeing == false) { move_cost = player.actions.move + 1; } if (player.actions.move >= move_cost) { canMove = true; } } } return canMove; }
// sp_regenerate internal static void AffectTrollRegenerate(Effect arg_0, object param, Player player) { if (player.HasAffect(Affects.regen_3_hp) == false && player.HasAffect(Affects.regenerate) == false) { ovr024.add_affect(true, 0xff, 3, Affects.regenerate, player); } }
// sub_3A517 internal static void AffectSlowPoison(Effect arg_0, object param, Player player) { if (player.HasAffect(Affects.poisoned) == true) { ovr024.KillPlayer("dies from poison", Status.dead, player); } gbl.cureSpell = true; ovr024.remove_affect(null, Affects.poison_damage, player); gbl.cureSpell = false; }
internal static void weaken(Effect arg_0, object param, Player player) { Affect affect = (Affect)param; if (addAffect(0x3c, affect.affect_data, Affects.weaken, player) == true) { if (player.stats2.Str.full > 3) { ovr025.DisplayPlayerStatusString(true, 10, "is weakened", player); player.stats2.Str.full--; } else if (player.HasAffect(Affects.helpless) == true) { ovr024.add_affect(false, 0xff, 0, Affects.helpless, player); } } }
internal static void sub_3B0C2(Effect arg_0, object param, Player player) { Affect affect = (Affect)param; if (addAffect(10, affect.affect_data, Affects.cause_disease_2, player) == true) { if (player.hit_point_current > 1) { gbl.damage_flags = 0; ovr024.damage_person(false, 0, 1, player); if (gbl.game_state != GameState.Combat) { ovr025.PartySummary(gbl.SelectedPlayer); } } else if (player.HasAffect(Affects.helpless) == false) { ovr024.add_affect(false, 0xff, 0, Affects.helpless, player); } } }