Battle Formulas

From Legends of Fairwind
Jump to: navigation, search

Battlemodepreview2.png

This section is still being designed.

Battle Order

Battle Order = D20 + Quickness
Tiebreaker 1 = Quickness
Tiebreaker 2 = Player goes before Monster
Tiebreaker 3 = Highest Experience, Date and Time of Creation, Database ID.

Surprise Round

When a battle begins, it is possible for either the players or the monsters to get a “surprise round.” If this happens, the opposing team starts out as if "stunned" until each is attacked, and don’t get to figure into the Battle Order until each of the attacking team's characters has expended their Action Points for the first round. Once they are introduced into the Battle Order, the as-if-stunned status goes away.

SurpriseRoll = D100 (0..99)

First we look for absolute roll, before resulting to ability evaluation:

If SurpriseRoll >= 95 the Party receives the Surprise Round.

If SurpriseRoll <= 4 the Monsters receive the Surprise Round.

    Surprise = MAX(Party Member Wisdom) - MAX(Monster Wisdom) + SurpriseRoll

If Surprise >= 99 the Party receives the Surprise Round.

if Surprise <= 0 the Monsters receive the Surprise Round.

If no Surprise round, everyone gets assigned to Battle Order immediately.

Overview of Attack Process

1. The Attack Formula is "rolled" to determine if the outcome is a hit, critical hit, or miss.

2. Damage is calculated. (Minimum 1)

3. Damage is reduced based on row configuration. (Minimum 1)

4. Damage absorption takes place. (Minimum 0)

5. The remaining damage is subtracted from HP of the attacked object (monster or player character.)

Core Ability Scores and what they Contribute Towards

Strength   Melee, Carrying Capacity?, Throwing
Vitality   Hitpoints, Immunity to Poison
Quickness  Dodge, Battle Order, Action Gauge, Run
Precision  Ranged, Critical Confirmation
Wisdom     Casting, Surprise Round, Magic Defense, Tactic Gauge
Rapport    Narrative and Negotiation with NPCs
SpellFail% Caused by Status Effects, also Inherent in Some Armor

Classes and Key Abilities (under development)

Warrior    Strength, Vitality
Paladin    Strength, Wisdom, Rapport
Mage       Wisdom, Rapport
Ranger     Wisdom, Precision
Thief      Quickness, Precision
Ninja      Quickness, Precision, Strength

Defense Targets

       Dodge = Quickness + DodgeBonus

If you are stunned, your Dodge is temporarily reduced to 0.

      Target = 10 + UntypedAC - TypedPenaltyToAC + Dodge

UntypedAC is the total basic Armor Class of your equipped items as well as any Racial Armor Class Bonus.

Some armors have weaknesses against certain types of attack. TypedPenaltyToAC depends on if the attack was piercing, slashing, hacking, or crushing and the style of armor being worn.

Damage Types

  • Piercing
  • Slashing
  • Hacking
  • Crushing
  • Fire
  • Ice
  • Electricity
  • Chemical
  • Sonic
  • Psionic
  • Radiation
  • Holy
  • Vile

Any damage type above may be used with either the “Magic” or “Mundane” keyword depending on how it is inflicted. Regular weapons generate Mundane damage. Most Spells also generate Mundane damage. For example, if a spell pummels an opponent with a shower of rocks, the damage itself is caused indirectly and is considered mundane damage. Magically enchanted weapons deal Magical damage.

(Mathematically, the purpose for spells generating mundane damage is so that AntiMagic isn't applied twice. If AntiMagic is 99, and the 1% success happens on an attack, the damage shouldn't also be almost completely absorbed.)

All damage values for weapons and spells are assigned a specific type from the above list.

Protection Against Damage Types

Some spells bypass armor (by affecting the core of the person.)

An untyped Damage Absorption Armor Bonus applies to all Damage Types but only when protected by armor.

An untyped Damage Absorption Enchantment Bonus applies to all Damage Types even if armor is bypassed, and is the best type of absorption available in the game.

A specifically typed DA Enchantment Bonus or DA Armor Bonus applies to a specific Damage Type (such as Fire) in addition to your untyped Bonus.

An AntiMagic enchantment also applies towards your Damage Absorption when taking damage of any magical damage type.

Attack Formulas

  AttackRoll = D20
        Miss = AttackRoll == 1
      Threat = AttackRoll >= 20 - ThreatRange
               (True) = See "If Threat" Below
              (False) = See "If Normal" Below
    If Threat:
 ConfirmRoll = D20
Confirmation = WeaponAttack + Precision + ConfirmRoll >= Target
               (True) = Critical Hit
              (False) = Hit
    If Normal:
(For Melee)
   AttackVal = WeaponAttack + Strength + AttackRoll
(For Ranged)
   AttackVal = WeaponAttack + Precision + AttackRoll - RangePenalty
(For Thrown)
   AttackVal = WeaponAttack + FLOOR((Precision+Strength)/2) + AttackRoll - RangePenalty

         Hit = AttackVal >= Target

Note: There's nothing like BAB going on here. I wonder if we will need that, or if the acquiring of more advanced weapons and the increase of the stat used for attack will make up for it.

Damage Formulas

   MeleeBase = WeaponBaseDamageRoll + Strength
  RangedBase = WeaponBaseDamageRoll + AmmoBaseDamageRoll
  ThrownBase = WeaponBaseDamageRoll + AmmoBaseDamageRoll + Strength
CriticalBase = Sum of MeleeBase or RangedBase or ThrownBase Rolled and Calculated Twice.

If the total Base Damage is zero or less, a Base Damage of 1 is inflicted.

Special Damage Formulas

Special Damage only has a chance of being inflicted if base damage was successfully inflicted. Use the original AttackVal (do not re-roll) but calculate the Target according to the appropriate Damage Type for the Special Damage.

   SpecialHit = AttackVal >= Target
SpecialDamage = WeaponSpecialDamageRoll + AmmoSpecialDamageRoll (if ranged or thrown)

Special Damage does not get doubled on a Critical Hit, but its roll is automatically maxed out. For example, a Critical Hit by a sword that deals 1d8 slashing + 1d4 fire(mundane) would deal all of the following:

Slashing (Mundane): 2D8 + 2xStrength
Fire (Mundane): 4

Note, however, that it is possible for a weapon to deal elemental damage as its Base Damage. If so, that damage would be considered Base Damage and would indeed be doubled on a critical hit.

Row Configuration

Monsters and players can either be in the front row or the back row. At least one person must be in the front row. If all monsters in the front row are killed, the back row monsters move up to the front row automatically.

Distance Score:

0 = ally on same row
1 = front row to opposite front row
2 = back row to opposite front row, cover only (only unconscious/sleeping/dead in between)
3 = back row to opposite front row, conscious creature in between
4 = back row player to back row monster, double cover
5 = back row player to back row monster, conscious creature on one row
6 = back row player to back row monster, conscious creatures on both rows

Melee Damage Amounts:

1 = 100% Damage
2 = 75% Damage
3 = 50% Damage
4 = 50% Damage
5 = Melee Impossible
6 = Melee Impossible

Short Ranged Damage Amounts

1 = 100% Damage, Opponent gets +2 Dodge (Point Blank)
2 = 100% Damage
3 = 100% Damage, Opponent gets +2 Dodge (Shooting through Melee)
4 = 50% Damage
5 = 50% Damage, Opponent gets +2 Dodge (Shooting through Melee)
6 = 50% Damage, Opponent gets +4 Dodge (Shooting through Melee)

Medium Range = 75% instead of 50% in the above list.

Long Range = 100% instead of 50% in the above list.

Damage Absorption

Damage Absorption is really just an X/16 fractional value of how much of all inflicted damage is Absorbed, but we have to use discrete math to avoid having fractional hitpoint outcomes.

Each Character or Monster has a “Spin” Counter. The same “Spin” is used for all Absorption taken by that Character. The initial Spin value is taken from entropy. AbsorbRate caps out at 16.

  Remainder = Damage MOD 16
   Absorbed = Floor(Damage / 16) * AbsorbRate + Quirk

Pseudocode to Calculate Quirk:

Quirk = 0
FOR I = 0 TO Remainder DO
  IF RateTable[AbsorbRate][Spin] THEN Quirk = Quirk + 1
  Spin = (Spin + 1) MOD 16
END FOR

Spellcasting

     CastRoll = D100 (00-99)
FizzleFailure = CastRoll < SpellFailure
EffectBlocked = CastRoll < Target's AntiMagic
    Excellent = CastRoll >= 100 - ThreatRange
TargetToAvoid = 10 + Level of Spell + Wisdom of Caster
        Touch = D20 : Touch Defense

Leveling Up

 HP Increase = Influenced by Vitality

Action Gauge

Each turn, the Action Gauge increases by Speed. When Gauge >= 32 an Extra Turn is given and the Action Gauge is reduced by 32.

Ranges

Level 0 = Uncreated, 1 - 30 = Normal, 31 = God

Strength, Vitality, Quickness, Precision, Wisdom, Rapport = 0 - 20 (Core)

Bonuses to ability scores due to weapon/armor equipment should max at 3 for each core stat.

Bonuses to ability scores due to accessory should max at 4 for each core stat.

Max Unbuffed Ability Score = 30 = 20 + 3(weapon) + 3(armor) + 4(accessory)

Max Buffed Ability Score = 31+

Absorptions are stackable, so max untyped absorption in any Helmet/Shield should probably be about 4 and in any Armor about 7. Weapons should rarely if ever have absorption, but if they do, it should be a maximum of 4.

Typed absorptions may be a little more generous since they would only grant specific immunity if maxed not immunity to damage altogether.

Max Unbuffed Untyped Absorption = 15 = 4 + 4 + 7

Max Buffed Untyped Absorption = 16+

Max Buffed AttackVal = WeaponAttack + 31 + 20

Max Buffed DamageTarget = 10 + TotalUntypedDefense + 31

So what does an item grant when equipped?

WEAPON-SPECIFIC:

  • WeaponAttack (A number to add to the Attack roll.)
  • WeaponBaseDamageRoll & Type (To add to the Damage Formulas)
  • WeaponSpecialDamageRoll & Type (To add to the Special Damage Formulas. Possible to have more than one per item.)
  • ThreatRange (How many outcomes are critical? Usually 1)

ARMOR and ACCESSORY(HELMET/SHIELD)-SPECIFIC:

  • UntypedAC (To add to the Defense Target.)
  • TypedPenaltyToAC & Type (To subtract from Defense Target. Possible to have more than one per item.)
  • Untyped Damage Absorption Armor Bonus (To add to the DR calculation.)
  • Typed Damage Absorption Armor Bonus (To add to the DR calculation. Possible to have more than one per item.)

NON-SPECIFIC (ACCESSORIES, WEAPONS, or ARMOR):

  • Untyped Damage Absorption Enchantment Bonus (To add to the DR calculation.)
  • Typed Damage Absorption Enchantment Bonus (To add to the DR calculation. Possible to have more than one per item.)
  • Ability Score Bonus (Add to core abilities. Possible to have more than one per item.)
  • MaxHP (Gives you more maximum hitpoints while equipped.)
  • MaxMP (Gives you more maximum magic points while eqiupped.)
  • Capacity (Gives you more carrying capacity while equipped.)

Rate Table

Some of the game math needs to calculate periodic rates. For example, during level-up ability score increases and for the fractional portion of damage absorption. The following table is used by the game in such cases and its use will be described later in the mechanics where it is utilized.

Rate	0 1 2 3 4 5 6 7 8 9 A B C D E F ← Period
0	0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 = no absorption  
1	1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 =  6.25%
2	1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 = 12.5%
3	1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 = 18.75%
4	1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 = 25%
5	1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 = 31.25%
6	1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 = 37.5%
7	1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 = 43.75%
8	1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 = 50%
9	1 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 = 56.25%
10	1 1 0 1 1 0 1 0 1 1 0 1 1 0 1 0 = 62.5%
11	1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 = 68.75%
12	1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 = 75%
13	1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 = 81.25%
14	1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 = 87.5%
15	1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 = 93.75%
16	1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 = total immunity