コード例 #1
0
ファイル: mobile.py プロジェクト: NancyR/Lampost-Mud
 def config_instance(self, mobile):
     mobile.level = nudge(mobile.level if mobile.level else 1)
     mobile.defense = scale32(mobile.level, 100, -100)
     mobile.max_health = mobile.level * 8 + randint(mobile.level * mobile.level / 4, mobile.level * mobile.level)
     mobile.health = mobile.max_health
     mobile.weapon = None
     return super(MobileTemplateMerc, self).config_instance(mobile)
コード例 #2
0
ファイル: combat.py プロジェクト: NancyR/Lampost-Mud
def basic_hit(source, target):
    thdef0 = scale32(source.level, base_thdef0, base_thdef32)  # TODO -- strength modifier
    defense = max(-15, target.defense / 10)
    to_hit_roll = thdef0 - defense
    dice_roll = randint(0, 19)
    if dice_roll == 19 or dice_roll >= to_hit_roll:
        damage = source.calc_damage(target)
        source.broadcast(s="You hit {N} for " + unicode(damage) + ".", e="{n} hits {N}", t="{n} hits you!", target=target)
        target.rec_damage(damage)
        if target.dead:
            source.add_exp(calc_experience(source, target))
    else:
        source.broadcast(s="You miss {N}.", e="{n} misses {N}", t="{n} misses you!", target=target)
        target.rec_damage(0)