summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorFate <fate-tmw@googlemail.com>2009-09-27 15:32:58 +0000
committerFate <fate-tmw@googlemail.com>2009-09-27 15:32:58 +0000
commitbf27f14214997e97aad2a80b24885b8f9af30e0a (patch)
tree54181661f30141f3b0218d9383a5de9327524a91 /src/map/battle.c
parent02ce702acb0fadcaf76470a94194f1d20e4c8bc0 (diff)
downloadtmwa-bf27f14214997e97aad2a80b24885b8f9af30e0a.tar.gz
tmwa-bf27f14214997e97aad2a80b24885b8f9af30e0a.tar.bz2
tmwa-bf27f14214997e97aad2a80b24885b8f9af30e0a.tar.xz
tmwa-bf27f14214997e97aad2a80b24885b8f9af30e0a.zip
Added "Mallard's Eye" skill (45) for ranged weapon users: increase
to-hit, increase range, decrease the malus effect of distance. Also added an up to 31.25% damage bonus for hitting enemies that are farther away (only affects ranged weapons). Fixed a bug that would forget to recompute stats after changing skill focus.
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 9b5f699..177c63e 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2283,6 +2283,7 @@ static struct Damage battle_calc_pc_weapon_attack(
int watk,watk_,cardfix,t_ele;
int da=0,i,t_class,ac_flag = 0;
int idef_flag=0,idef_flag_=0;
+ int target_distance;
//return前の処理があるので情報出力部のみ変更
if( src == NULL || target == NULL || sd == NULL ){
@@ -2354,27 +2355,36 @@ static struct Damage battle_calc_pc_weapon_attack(
}
}
hitrate=battle_get_hit(src) - flee + 80; //命中率計算
- battle_is_unarmed(src);
- { // [Fate] Reduce hit chance by distance
+
+ { // [fate] Reduce hit chance by distance
int dx = abs(src->x - target->x);
int dy = abs(src->y - target->y);
- int dist = MAX(dx, dy);
- hitrate -= (dist * (dist + 1));
- }
+ int malus_dist;
- type=0; // normal
- div_ = 1; // single attack
+ target_distance = MAX(dx, dy);
+ malus_dist = MAX(0, target_distance - (skill_power(sd, AC_OWL) / 75));
+ hitrate -= (malus_dist * (malus_dist + 1));
+ }
dex=battle_get_dex(src); //DEX
luk=battle_get_luk(src); //LUK
watk = battle_get_atk(src); //ATK
watk_ = battle_get_atk_(src); //ATK左手
+ type=0; // normal
+ div_ = 1; // single attack
+
if(skill_num==HW_MAGICCRASHER){ /* マジッククラッシャーはMATKで殴る */
damage = damage2 = battle_get_matk1(src); //damega,damega2初登場、base_atkの取得
}else{
damage = damage2 = battle_get_baseatk(&sd->bl); //damega,damega2初登場、base_atkの取得
}
+ if (sd->attackrange > 2) { // [fate] ranged weapon?
+ const int range_damage_bonus = 80; // up to 31.25% bonus for long-range hit
+ damage = damage * (256 + ((range_damage_bonus * target_distance) / sd->attackrange)) >> 8;
+ damage2 = damage2 * (256 + ((range_damage_bonus * target_distance) / sd->attackrange)) >> 8;
+ }
+
atkmin = atkmin_ = dex; //最低ATKはDEXで初期化?
sd->state.arrow_atk = 0; //arrow_atk初期化
if(sd->equip_index[9] >= 0 && sd->inventory_data[sd->equip_index[9]])