Created
August 26, 2012 17:01
-
-
Save caasi/3481658 to your computer and use it in GitHub Desktop.
fo2 pseudo code ez version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int apply_distance_modifier() { | |
attack_is_ranged = 1; | |
int mod; | |
int new_perception = attacker_is_player ? attacker_perception - 2 : attacker_perception; | |
int dist = target_invalid ? 0 : distance_between_attacker_and _target; | |
switch(weapon_perk) { | |
case long_range: | |
mod = (new_perception * 4 - dist) * 4; | |
break; | |
case scope_range: | |
dist = dist < 8 ? dist + 8 : dist; | |
mod = (new_perception * 5 - dist) * 4; | |
break; | |
default: | |
mod = (new_perception * 2 - dist) * 4; | |
break; | |
}; | |
mod = min(8 * attacker_perception, mod); | |
if (attacker_is_player) mod += 8 * player_sharpshooter_level; | |
if (attacker_eye_damage && mod <= 0) mod *= 3; | |
if (!attack_with_norange_argument || mod > 0) tohit += mod; | |
if (!target_invalid && !attack_with_norange_argument) tohit -= 10 * objects_between_attacker_and_target; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment