// sub_6AAEA internal static void reclac_thief_skills(Player player) { byte var_2 = 0; //Simeon var item_found = player.items.Find(item => item.readied && (item.ScrollLearning(3, 2) || item.ScrollLearning(3, 11))); var var_A = item_found != null && item_found.ScrollLearning(3, 11); var var_B = item_found != null && item_found.ScrollLearning(3, 2); int thiefLvl = player.SkillLevel(SkillType.Thief); if (thiefLvl < 4 && var_B == true) { thiefLvl = 4; var_B = false; } int orig_thief_lvl = thiefLvl; for (int skill = 1; skill <= 8; skill++) { if (var_A == true) { switch (skill) { case 1: if (thiefLvl < 5) { thiefLvl = 5; var_2 = 0; } else { var_2 = 5; } break; case 2: if (thiefLvl < 7) { thiefLvl = 7; var_2 = 0; } else { var_2 = 5; } break; } } if (unk_1A230[(int)player.race, skill] < 0 && base_chance[thiefLvl, skill] < (System.Math.Abs(unk_1A230[(int)player.race, skill]) + var_2)) { player.thief_skills[skill - 1] = 0; } else { player.thief_skills[skill - 1] = (byte)(var_2 + base_chance[thiefLvl, skill] + unk_1A230[(int)player.race, skill]); if (skill < 6) { player.thief_skills[skill - 1] += (byte)unk_1A243[player.stats2.Dex.full, skill]; } } if (var_B == true) { player.thief_skills[skill - 1] += 10; } thiefLvl = orig_thief_lvl; } }
// sub_6A00F internal static void sub_6A00F(Player player) { for (int i = 0; i < 5; i++) { player.spellCastCount[0, i] = 0; player.spellCastCount[1, i] = 0; player.spellCastCount[2, i] = 0; } for (SkillType skill = SkillType.Cleric; skill <= SkillType.Monk; skill++) { int skillLevel = player.SkillLevel(skill); if (skillLevel > 0) { switch (skill) { case SkillType.Cleric: player.spellCastCount[0, 0] += 1; for (int PlayerLvl = 0; PlayerLvl <= (skillLevel - 2); PlayerLvl++) { for (int sp_lvl = 0; sp_lvl < 5; sp_lvl++) { player.spellCastCount[0, sp_lvl] += ClericSpellLevels[PlayerLvl, sp_lvl]; } } calc_cleric_spells(false, player); foreach (Spells spell in System.Enum.GetValues(typeof(Spells))) { SpellEntry se = gbl.spellCastingTable[(int)spell]; int sp_class = (se.spellLevel - 1) / 5; int sp_lvl = (se.spellLevel - 1) % 5; if (se.spellClass == 0 && player.spellCastCount[sp_class, sp_lvl] > 0 && spell != Spells.animate_dead) { player.LearnSpell(spell); } } break; case SkillType.Paladin: if (skillLevel > 8) { for (int addLvl = 8; addLvl < skillLevel; addLvl++) { for (int spellLvl = 0; spellLvl < 5; spellLvl++) { player.spellCastCount[0, spellLvl] += PaladinSpellLevels[addLvl, spellLvl]; } } foreach (Spells spell in System.Enum.GetValues(typeof(Spells))) { SpellEntry se = gbl.spellCastingTable[(int)spell]; int sp_class = (se.spellLevel - 1) / 5; int sp_lvl = (se.spellLevel - 1) % 5; if (se.spellClass == 0 && player.spellCastCount[sp_class, sp_lvl] > 0) { player.LearnSpell(spell); } } } break; case SkillType.Ranger: if (skillLevel > 7) { for (int var_3 = 8; var_3 <= skillLevel; var_3++) { for (int sp_lvl = 0; sp_lvl < 3; sp_lvl++) { player.spellCastCount[1, sp_lvl] += unk_1A758[var_3, sp_lvl]; } for (int sp_lvl = 3; sp_lvl < 5; sp_lvl++) { player.spellCastCount[2, sp_lvl - 3] += unk_1A758[var_3, sp_lvl]; } } foreach (Spells spell in System.Enum.GetValues(typeof(Spells))) { if (gbl.spellCastingTable[(int)spell].spellClass == SpellClass.Druid) { player.LearnSpell(spell); } } } break; case SkillType.MagicUser: player.spellCastCount[2, 0] += 1; for (int lvl = 0; lvl <= (skillLevel - 2); lvl++) { /* unk_1A7C6 = seg600:44B6 */ player.spellCastCount[2, 0] += ovr020.MU_spell_lvl_learn[lvl, 0]; player.spellCastCount[2, 1] += ovr020.MU_spell_lvl_learn[lvl, 1]; player.spellCastCount[2, 2] += ovr020.MU_spell_lvl_learn[lvl, 2]; player.spellCastCount[2, 3] += ovr020.MU_spell_lvl_learn[lvl, 3]; player.spellCastCount[2, 4] += ovr020.MU_spell_lvl_learn[lvl, 4]; } break; } } } foreach (Item item in player.items) { if (item.affect_3 == Affects.protect_magic && item.readied) { for (int sp_lvl = 0; sp_lvl < 3; sp_lvl++) { player.spellCastCount[2, sp_lvl] *= 2; } } } }
internal static void combat_menu(out char arg_0, Player player) { string menuText = string.Empty; if (player.actions.move > 0) { menuText += "Move "; } menuText += "View Aim "; if (player.items.Count > 0) { menuText += "Use "; } bool hasSpells = player.spellList.HasSpells(); if (hasSpells == true && player.actions.can_cast == true && gbl.area_ptr.can_cast_spells == false) { menuText += "Cast "; } if (player.SkillLevel(SkillType.Cleric) > 0 && player.actions.hasTurnedUndead == false) { menuText += "Turn "; } menuText += "Quick Done"; do { bool ctrlKey; arg_0 = ovr027.displayInput(out ctrlKey, false, 1, gbl.defaultMenuColors, menuText, string.Empty); if (ctrlKey == true && unk_33748.MemberOf(arg_0) == false) { arg_0 = '\0'; } } while (unk_33768.MemberOf(arg_0) == false); ovr027.ClearPromptArea(); }
/* sub_6A686 */ internal static void calc_cleric_spells(bool ResetSpellLevels, Player player) { int clericLvl = player.SkillLevel(SkillType.Cleric); if (clericLvl > 0) { if (ResetSpellLevels == true) { for (int sp_lvl = 1; sp_lvl < 5; sp_lvl++) { player.spellCastCount[0, sp_lvl] = 0; } player.spellCastCount[0, 0] = 1; for (int playerLvl = 0; playerLvl <= (clericLvl - 2); playerLvl++) { for (int spellLvl = 0; spellLvl < 5; spellLvl++) { player.spellCastCount[0, spellLvl] += ClericSpellLevels[playerLvl, spellLvl]; } } } if (player.stats2.Wis.full > 12 && player.spellCastCount[0, 0] > 0) { player.spellCastCount[0, 0] += 1; } if (player.stats2.Wis.full > 13 && player.spellCastCount[0, 0] > 0) { player.spellCastCount[0, 0] += 1; } if (player.stats2.Wis.full > 14 && player.spellCastCount[0, 1] > 0) { player.spellCastCount[0, 1] += 1; } if (player.stats2.Wis.full > 15 && player.spellCastCount[0, 1] > 0) { player.spellCastCount[0, 1] += 1; } if (player.stats2.Wis.full > 16 && player.spellCastCount[0, 2] > 0) { player.spellCastCount[0, 2] += 1; } if (player.stats2.Wis.full > 17 && player.spellCastCount[0, 3] > 0) { player.spellCastCount[0, 3] += 1; } } }
// sub_5F126 internal static bool sub_5F126(Player arg_2, int target_count) { int muLvl = arg_2.SkillLevel(SkillType.MagicUser); int roll; if (target_count > muLvl) { roll = ((target_count - muLvl) * 5) + 50; } else if (target_count < muLvl) { roll = 50 - ((muLvl - target_count) * 2); } else { roll = 50; } return ovr024.roll_dice(100, 1) <= roll; }
/* sub_5C01E */ internal static bool can_learn_spell(int spell_id, Player player) { spell_id &= 0x7f; bool can_learn = false; switch (gbl.spellCastingTable[spell_id].spellClass) { case SpellClass.Cleric: if (player.stats2.Wis.full > 8 && (player.SkillLevel(SkillType.Cleric) > 0 || player.SkillLevel(SkillType.Paladin) > 8)) { can_learn = true; } break; case SpellClass.Druid: if ((player.stats2.Wis.full > 8 && player.SkillLevel(SkillType.Ranger) > 6)) { can_learn = true; } break; case SpellClass.MagicUser: if (player.stats2.Int.full > 8 && ((player.race != Race.human) || (player.activeItems.armor == null) || (gbl.game_state != GameState.Combat) || (player.SkillLevel(SkillType.Ranger) > 8) || (player.SkillLevel(SkillType.MagicUser) > 0))) { can_learn = true; } break; case SpellClass.Monster: can_learn = false; break; } return can_learn; }
/* 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); }
internal static void PaladinHeal(Player player) { ovr025.LoadPic(); Player target = gbl.TeamList[0]; ovr025.selectAPlayer(ref target, true, "Heal whom? "); if (target == null) { playerDisplayFull(gbl.SelectedPlayer); return; } int healAmount = player.SkillLevel(SkillType.Paladin) * 2; if (ovr024.heal_player(0, healAmount, target) == true) { ovr025.string_print01(target.name + " feels better"); } else { ovr025.string_print01(target.name + " is unaffected"); } ovr024.add_affect(false, 0, 1440, Affects.paladinDailyHealCast, player); playerDisplayFull(gbl.SelectedPlayer); }
/* sub_66C20 */ internal static void reclac_player_values(Player player) { sbyte[] stat_bonus = new sbyte[5]; player.activeItems.Reset(); bool var_8 = false; player.weaponsHandsUsed = 0; player.weight = 0; int totalItemWeight = 0; foreach (var item in player.items) { short item_weight = item.weight; if (item.count > 0) { item_weight *= (short)item.count; } player.weight += item_weight; if (item.readied) { totalItemWeight += item_weight; ItemSlot slot = gbl.ItemDataTable[item.type].item_slot; if (slot >= ItemSlot.slot_0 && slot <= ItemSlot.slot_8) { player.activeItems[slot] = item; } else if (slot == ItemSlot.slot_9) { if (player.activeItems.Item_ptr_01 != null) { if (player.activeItems.Item_ptr_02 == null) { player.activeItems.Item_ptr_02 = item; } } else { player.activeItems.Item_ptr_01 = item; } } if (item.type == ItemType.Arrow) { player.activeItems.arrows = item; } if (item.type == ItemType.Quarrel) { player.activeItems.quarrels = item; } player.weaponsHandsUsed += item.HandsCount(); } } for (int money = 0; money < 7; money++) { player.weight += (short)player.Money.GetCoins(money); } player.attack1_DiceCount = player.attack1_DiceCountBase; player.attack2_DiceCount = player.attack2_DiceCountBase; player.attack1_DiceSize = player.attack1_DiceSizeBase; player.attack2_DiceSize = player.attack2_DiceSizeBase; player.attack1_DamageBonus = (sbyte)player.attack1_DamageBonusBase; player.attack2_DamageBonus = player.attack2_DamageBonusBase; for (int i = 0; i <= 4; i++) { stat_bonus[i] = 0; } byte var_7 = 0; player.field_186 = 0; player.ac = player.base_ac; player.movement = player.base_movement; player.hitBonus = player.thac0; stat_bonus[0] = ovr025.DexAcBonus(player); if (player.activeItems.primaryWeapon == null) { player.hitBonus += strengthHitBonus(player); player.attack1_DamageBonus += strengthDamBonus(player); } CalculateAttackValues(player); foreach (var item in player.items) { if (item.readied) { CalcArmorWeightEffect(item, player); sub_662A6(ref var_7, ref stat_bonus, item, player); } } if (var_7 != 0) { stat_bonus[3] = 0; } if (var_8 == true) { if (player.weight < 5000) { player.weight = 0; } else { player.weight -= 5000; } if (player.weight < totalItemWeight) { player.weight = (short)totalItemWeight; } } calc_movement(player); if (stat_bonus[4] < player.ac) { stat_bonus[4] = (sbyte)player.ac; } player.ac = 0; for (int i = 0; i <= 4; i++) { player.ac += (byte)stat_bonus[i]; } player.ac_behind = (byte)((stat_bonus[4] + stat_bonus[2] + stat_bonus[3]) - 2); if (player.SkillLevel(SkillType.Fighter) > 0 && player.race > Race.monster) { player.attackLevel = (byte)player.SkillLevel(SkillType.Fighter); } else { player.attackLevel = 1; } }
/* sub_57655 */ internal static bool CanCastCureDiseases(Player player) { return (player.SkillLevel(SkillType.Paladin) > 0 && gbl.game_state != GameState.Combat && player.health_status == Status.okey && player.paladinCuresLeft > 0); }
internal static void sub_3A89E(Effect arg_0, object param, Player player) { Affect affect = (Affect)param; affect.callAffectTable = false; if (gbl.cureSpell == false) { ovr024.KillPlayer("collapses", Status.dead, player); } player.combat_team = (CombatTeam)(affect.affect_data >> 4); player.quick_fight = QuickFight.True; player.field_E9 = 0; player.attackLevel = (byte)player.SkillLevel(SkillType.Fighter); player.base_movement = 0x0C; if (player.control_morale == Control.PC_Berzerk) { player.control_morale = Control.PC_Base; } player.monsterType = 0; }
// sub_3C8EF internal static void PaladinCastCureRefresh(Effect add_remove, object param, Player player) { if (add_remove == Effect.Remove) { player.paladinCuresLeft = (byte)(((player.SkillLevel(SkillType.Paladin) - 1) / 5) + 1); } }
/* sub_408D7 */ internal static bool CanBackStabTarget(Player target, Player attacker) { if (attacker.SkillLevel(SkillType.Thief) > 0) { Item weapon = attacker.activeItems.primaryWeapon; if (weapon == null || weapon.type == ItemType.DrowLongSword || weapon.type == ItemType.Club || weapon.type == ItemType.Dagger || weapon.type == ItemType.BroadSword || weapon.type == ItemType.LongSword || weapon.type == ItemType.ShortSword) { if (target.actions.AttacksReceived > 1 && (target.field_DE & 0x7F) <= 1 && getTargetDirection(target, attacker) == target.actions.direction) { return true; } } } return false; }
static void sub_3E192(int index, Player target, Player attacker) { gbl.damage = ovr024.roll_dice_save(attacker.attackDiceSize(index), attacker.attackDiceCount(index)); gbl.damage += attacker.attackDamageBonus(index); if (gbl.damage < 0) { gbl.damage = 0; } if (CanBackStabTarget(target, attacker) == true) { gbl.damage *= ((attacker.SkillLevel(SkillType.Thief) - 1) / 4) + 2; } gbl.damage_flags = 0; ovr024.CheckAffectsEffect(attacker, CheckType.SpecialAttacks); ovr024.CheckAffectsEffect(target, CheckType.Type_5); }
internal static void turns_undead(Player player) { ovr025.DisplayPlayerStatusString(false, 10, "turns undead...", player); ovr027.ClearPromptArea(); seg041.GameDelay(); bool any_turned = false; byte var_6 = 0; player.actions.hasTurnedUndead = true; byte var_3 = 6; int var_2 = ovr024.roll_dice(12, 1); int var_1 = ovr024.roll_dice(20, 1); int clericLvl = player.SkillLevel(SkillType.Cleric); byte var_B; if (clericLvl >= 1 && clericLvl <= 8) { var_B = player.cleric_lvl; } else if (clericLvl >= 9 && clericLvl <= 13) { var_B = 9; } else { var_B = 10; } Player target; while (FindLowestE9Target(out target, player) == true && var_2 > 0 && var_6 == 0) { int var_4 = unk_16679[(target.field_E9 * 10) + var_B]; if (var_1 >= System.Math.Abs(var_4)) { any_turned = true; ovr033.RedrawCombatIfFocusOn(false, 3, target); gbl.display_hitpoints_ac = true; ovr025.CombatDisplayPlayerSummary(target); if (var_4 > 0) { target.actions.fleeing = true; ovr025.MagicAttackDisplay("is turned", true, target); } else { ovr025.DisplayPlayerStatusString(false, 10, "Is destroyed", target); ovr033.CombatantKilled(target); target.health_status = Status.gone; target.in_combat = false; } if (var_3 > 0) { var_3 -= 1; } var_2 -= 1; if (var_2 == 0 && var_3 > 0 && var_4 < 0) { var_2++; } ovr025.ClearPlayerTextArea(); } else { var_6 = 1; } } if (any_turned == false) { ovr025.string_print01("Nothing Happens..."); } ovr025.CountCombatTeamMembers(); ovr025.clear_actions(player); ovr025.ClearPlayerTextArea(); }