//----------------------- PVE ------------------------------ // Player VS Enemy, || player attack, enemy defense public static void Combat(Player p, Enemy e) { int modBouns = 0; //List<Weapon> playerWeapons = p.weapons; //weapons player own Weapon weapon = p.weapons[0]; //weapons player use for this combat //check 1)if the weapon si a finess weapon 2) add ability modify bouns base on the weapon type if (weapon.type == Weapon.Type.Melee) { modBouns = (weapon.isFiness) ? ((p.abm.STR > p.abm.DEX) ? p.abm.STR : p.abm.DEX) : p.abm.STR; } else if (weapon.type == Weapon.Type.Ranged) { modBouns = (weapon.isFiness) ? ((p.abm.STR > p.abm.DEX) ? p.abm.STR : p.abm.DEX) : p.abm.DEX; } //check 1)if the weapon is in the proficiency weapon list 2) add proficiency bouns bool isProficiencyWeapon = p.proficiencyWeaponList.Exists(o => o == weapon.name); int proficiencyBouns = (isProficiencyWeapon) ? p.proficiencyBouns : 0; //total Bouns int AttackBouns = proficiencyBouns + modBouns; //the weapon dice Dice playerWeaponDice = weapon.dice; //check 1)is attack success 2)damage AttackChecker acer = AttackCheck(p, AttackBouns, e.armorClass); if (acer.isAttackSuccess) { e.health -= DamageCheck(p, weapon, acer.isCritical); } }
//---------------------------------------------------------- //----------------------- EVP ------------------------------ // Enemy VS Player, || enemy attack, player defense public static void Combat(Enemy e, Player p) { //TODO 1)enemy attack and danmage calculate //check 1)is attack success 2)damage AttackChecker acer = AttackCheck(e, p); if (acer.isAttackSuccess) { e.health -= DamageCheck(e, acer.isCritical); } }