Combat

From IvanWiki
Revision as of 08:56, 12 August 2014 by 4zb4 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The strength requirement of an item is: 1.25 * 10^-10 * Weight ^ 2 * Size ^ 2

The hit strength of a weapon is: (Arm Strength) - (Strength Requirement) If you're dual-wielding, use combined arm strength and half the strength requirement.

Weapon skill bonuses are equal to: 1000 + 50 * (Skill Level)

Any weapon or armor's THVBonus (To Hit Bonus) is: Enchantment * 0.5

Move Ease is based on burden state: OverLoaded = 50 Stressed = 50 Burdened = 75 Unburdened = 100 Anything Else = 666 (Yeah. Shouldn't actually happen.)

Your to-hit-value when unarmed is: Dexterity * sqrt(2.5 * perception) * (Move Ease) * (Unarmed skill bonus) * (10 + Gauntlet's THV Bonus) / 5000000

Your to-hit-value when armed is: If the hit strength of your weapon is 0 or less, 0 If your weapon's hit strength is less than 10 but over 0, pretend it was 10. Base = 2 * 10 ^ -11 * (Weapon's hit strength) * (Weapon class skill bonus) * (Specific weapon skill bonus) * (Move Ease) * 10000 / (1000 + weapon weight + (enchantment / 2)) ThisToHit = dexterity * sqrt(2.5 * perception); And your to-hit-value is ThisToHit * Base. There are, however, special cases, if your other arm is usable. If your other arm has no weapon, and the first arm's weapon is two handed and not a sheild: Add (other arm's dexterity) * sqrt(2.5 * perception) to ThisToHit. Then divide ThisToHit by two. If your other arm does have a weapon, and neither weapon is a shield: Divide ThisToHit by 1 + (500 * (Arm2's weapon weight)) / (1000 + (Arm1's weapon weight) / 2)

The blocking modifier of a weapon is: Size * Roundness * 2. Multiply by an additional two for shields.

Blocking value is: ToHitValue * Block Modifier / 10000

The blocking capability of a weapon: If you have no weapon or our weapon's hit strength is 0 or less, then 0. If you're still here, pretend your weapon's hit strength was at least 10. Blocking Capability is (hit strength) * (weapon's strength) * (weapon skill class bonus) * (specific weapon bonus) / 10000000

For each arm you block with: BlockStrength = GetBlockCapability BlockValue = GetBlockValue if either of those are 0, do nothing and give up on this function

you'll block if: RAND() % int(100 + WeaponToHitValue / BlockValue / (1 << BlocksSinceLastTurn) * (100 +

Success)) < 100) if you don't, give up on this function new damage is damage - blockstrength. Minimum is 0. lose (10000 / Arm Strength) stamina gain some strength based on the weight of the item you blocked with. gain some dex based on some crazy crud I can't be bothered to figure out (long DexExp = Weight ? Limit(75000L / Weight, 75L, 300L) : 300;) if you're dual-weilding, do that same experience for both arms receive some skill in your weapon based on relative strength of who you blocked the item you blocked with recieves damage equal to the ORIGINAL damage before block

if what you blocked was an item (I THINK, could just be still existing) it recieves damage equal to the difference between original and new damages if your blocks since last turn isn't 16 yet, add one to that count.


Dodging attacks: if the attacker can't be seen by the target, double ToHitValue if the target can't be seen by the attacker, double DodgeValue if the attacker is confused, multiply ToHitValue by 0.75 if the attacker is fainting, halve ToHitValue if the attacker is exhausted, multiply ToHitValue by 0.75 if the target is fainting, halve DodgeValue if the target is exhausted, multiply DodgeValue by 0.75

If it's going to be a critical, target won't dodge. If it's a forced hit, target won't dodge.

Chance of dodge is: RAND() % int(100 + ToHitValue / DodgeValue * (100 + Success)) < 100 A comment in the source says this means: /* Effectively, the average chance to hit is 100% / (DV/THV + 1). */ Successfully dodging attacks trains agility and perception (twice as much agility)

Damage is boosted Success percent. (100 damage, 4 success = 104 damage). Two thirds of the time, one more point is added to damage. A critical hit adds an extra half to damage, then adds one more point.

!!! BodyPart = ChooseBodyPartToReceiveHit(ToHitValue, DodgeValue)

Only can block if it's not a critical, and it did damage, and this attack is blockable If you're doing something, you won't block (I think that's what that line means.)

If you have something in your right hand, it'll try to block with it. If there's still damage, you have something in your left, and (I think) there's still a

weapon to attack you with, you'll block with your left.


Someone else should feel free to try to organize that better. That might not be the entirety of the dodge function, by the way. I don't remember.