|  | 
 
| 攻击时的damage主要计算流程(命中以后): 
 复制代码
//只有装备武器才有效,否则 apply/damage=0
//不过perform可能设 apply/damage
//玄铁剑 apply/damage = 150 my_str = 70 my_jiali = 100
//按剑法 damage=100,force=300
damage = me->query_temp("apply/damage");
damage = (damage + random(damage)) / 2;
if( action["damage"] )
damage += action["damage"] * damage / 100;
// 此时damage=75~150
 
damage_bonus = me->query_str();
if( my["jiali"] && (my["neili"] > my["jiali"]) ) {
    if( force_skill = me->query_skill_mapped("force") ) {
        foo = SKILL_D(force_skill)->hit_ob(me, victim, damage_bonus, my["jiali"]);
        // force 里的 hit_ob() 写的好难懂,谁给解释一下?
        if( stringp(foo) ) result += foo;
        else if( intp(foo) ) damage_bonus += foo;
    }
}
// 加力是不是经常不起作用? damage_bonus = 70 不变
// 起作用时 damage_bonus = 170 左右
 
if( action["force"] )
damage_bonus += action["force"] * damage_bonus / 100;
// damage_bonus = 210
 
if( martial_skill = me->query_skill_mapped(attack_skill) ) {
    foo = SKILL_D(martial_skill)->hit_ob(me, victim, damage_bonus);
    if( stringp(foo) ) result += foo;
    else if(intp(foo) ) damage_bonus += foo;
}
// 一般skill里没有 hit_ob() 函数,因此damage_bonus 不变
 
if( damage_bonus > 0 )
    damage += (damage_bonus + random(damage_bonus))/2;
    //damage = 75~150 + 105~210 = 180~360
     
// 经验和挪移,铁布衫等的影响,略去
defense_factor = your["combat_exp"];
while( random(defense_factor) > my["combat_exp"] ) {
    damage -= damage / 3;
    defense_factor /= 2;    // 好象这句是废话,没有任何作用
}
 
damage = victim->receive_damage("qi", damage, me );
 
if( random(damage) > (int)victim->query_temp("apply/armor")
        && ( (me->is_killing(victim->query("id")))
        // 只有kill时才会受伤吗???
        && ((!weapon) && !random(4) || weapon && !random(2) )
        || ((!weapon) && !random(7) || weapon && !random(4) ) ))
        //搞这么复杂意义何在???
{
    // We are sure that damage is greater than victim's armor here.
    victim->receive_wound("qi",damage - (int)victim->query_temp("apply/armor"), me);
    wounded = 1;
}
 
因此带一把剑伤害在 180~360,两把剑为 255~510,空手 105~210
 | 
 |