コード例 #1
0
def do_kill(char, args):
    import mobile
    import combat

    if char.player.fighting is not None:
        _.send_to_char(char, "You are already fighting!\n\r")
        return
    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Kill whom?\n\r")
        return
    temp_target = mobile.get_mobile_in_room(target, char.player.get_room())
    if temp_target is None:
        _.send_to_char(char, "They aren't here.\n\r")
        return
    elif temp_target == char.player:
        _.send_to_char(char, "Suicide is a mortal sin.\n\r")
        return
    combat.start_combat(char.player, temp_target)
    temp_vector = temp_target.get_peer()
    combat.start_combat_block()
    if temp_vector is not None:
        do_yell(temp_vector, "Help! I am being attacked by %s!" % char.player.get_name())
    combat.do_one_round(char.player)
    combat.end_combat_block()
コード例 #2
0
ファイル: spells.py プロジェクト: csakoda/rdu
 def lost_concentration(self, peer):
     import combat
     peer.account.player.add_lag(self.lag)
     peer.account.player.send("You lost your concentration.\n\r")
     _.send_to_room_except("%s utters the words, '%s'.\n\r" % (peer.account.player.get_name(), self.words), \
                           peer.account.player.get_room(), [peer,])
     combat.end_combat_block()
コード例 #3
0
 def lost_concentration(self, peer):
     import combat
     peer.account.player.add_lag(self.lag)
     peer.account.player.send("You lost your concentration.\n\r")
     _.send_to_room_except("%s utters the words, '%s'.\n\r" % (peer.account.player.get_name(), self.words), \
                           peer.account.player.get_room(), [peer,])
     combat.end_combat_block()
コード例 #4
0
def do_dirtkick(peer, args, target, success):
    combat.start_combat_block()
    if success:
        _.affect_list["dirtkick"].apply_affect(target, 24)
    else:
        combat.do_damage(peer.account.player, target, 0, "kicked dirt", False)
    combat.end_combat_block()
コード例 #5
0
 def lost_concentration(self, char):
     import combat
     char.player.add_lag(self.lag)
     _.send_to_char(char, "You lost your concentration.\n\r")
     _.send_to_room_except("%s utters the words, '%s'.\n\r" % (char.player.get_name(), self.words), \
                           char.player.get_room(), [char,])
     combat.end_combat_block()
コード例 #6
0
def do_bash(peer, args, target, success):
    combat.start_combat_block()
    if success:
        peer.account.player.send(
            "You send %s flying with a powerful bash!?!?!?\n\r" %
            target.get_name(peer.account.player))
        target.send("%s sends you flying with a powerful bash!\n\r" %
                    peer.account.player.get_name())
        _.send_to_room_except(
            "%s sends %s flying with a powerful bash!\n\r" %
            (peer.account.player.get_name(), target.get_name()),
            peer.account.player.get_room(), [peer, target.peer])
        temp_damage = random.randint(2, 12)
        combat.do_damage(peer.account.player, target, temp_damage, "bash",
                         False)
        combat.start_combat(peer.account.player, target)
    else:
        peer.account.player.send("You fall flat on your face!\n\r")
        target.send("%s falls flat on their face!\n\r" %
                    peer.account.player.get_name())
        _.send_to_room_except(
            "%s falls flat on their face!\n\r" %
            peer.account.player.get_name(), peer.account.player.get_room(),
            [peer, target.peer])
    combat.end_combat_block()
コード例 #7
0
ファイル: commands.py プロジェクト: csakoda/rdu
def do_kill(peer, args):
    import mobile
    import combat

    if peer.account.player.fighting is not None:
        peer.account.player.send("You are already fighting!\n\r")
        return
    try:
        target = args.split()[0]
    except IndexError:
        peer.account.player.send("Kill whom?\n\r")
        return
    temp_target = mobile.get_mobile_in_room(target, peer.account.player.get_room())
    if temp_target is None:
        peer.account.player.send("They aren't here.\n\r")
        return
    elif temp_target == peer.account.player:
        peer.account.player.send("Suicide is a mortal sin.\n\r")
        return
    combat.start_combat(peer.account.player, temp_target)
    temp_vector = temp_target.peer
    combat.start_combat_block()
    if temp_vector is not None:
        do_yell(temp_vector, "Help! I am being attacked by %s!" % peer.account.player.get_name())
    combat.do_one_round(peer.account.player)
    combat.end_combat_block()
コード例 #8
0
 def lost_concentration(self, char):
     import combat
     char.player.add_lag(self.lag)
     _.send_to_char(char, "You lost your concentration.\n\r")
     _.send_to_room_except("%s utters the words, '%s'.\n\r" % (char.player.get_name(), self.words), \
                           char.player.get_room(), [char,])
     combat.end_combat_block()
コード例 #9
0
    def execute_spell(self, peer, args):

        #  Check in_combat
        if peer.account.player.fighting is not None and not self.in_combat:
            peer.account.player.send(
                "You can't cast that spell in combat.\n\r")
            return

        #  Find target
        if self.target_state == _.TARGET_SELF_ONLY:
            target = peer.account.player
        elif self.target_state == _.TARGET_PREFER_SELF:
            try:
                target = mobile.get_mobile_in_room(
                    args.split()[0], peer.account.player.get_room())
                if target == None:
                    peer.account.player.send("They aren't here.\n\r")
                    return
            except IndexError:
                target = peer.account.player
        elif self.target_state == _.TARGET_PREFER_FIGHTING:
            try:
                target = mobile.get_mobile_in_room(
                    args.split()[0], peer.account.player.get_room())
                if target == None:
                    peer.account.player.send("They aren't here.\n\r")
                    return
            except IndexError:
                if peer.account.player.fighting is None:
                    peer.account.player.send("You aren't fighting anyone.\n\r")
                    return
                else:
                    target = peer.account.player.fighting
        elif self.target_state == _.TARGET_TARGET_ONLY:
            try:
                target = mobile.get_mobile_in_room(
                    args.split()[0], peer.account.player.get_room())
                if target == None:
                    peer.account.player.send("They aren't here.\n\r")
                    return
            except IndexError:
                peer.account.player.send("You must provide a target.\n\r")
                return
        else:
            target = None

        combat.start_combat_block()
        if self.aggro:
            combat.start_combat(peer.account.player, target)
        if random.randint(
                0, 1
        ) == 5:  # -Rework- right now there's no chance of losing concentration
            self.lost_concentration(peer)
            return
        _.send_to_room_except("%s utters the words, '%s'.\n\r" % (peer.account.player.get_name(), self.words), \
                              peer.account.player.get_room(), [peer,])
        self.function(peer, args, target)
        combat.end_combat_block()
        peer.account.player.add_lag(self.lag)
コード例 #10
0
def do_sap(peer, args, target, success):
    if success:  # Success
        target.remove_from_combat()
        target.set_position(_.POS_SLEEPING)
        _.affect_list["sap"].apply_affect(target, 12)
    else:
        combat.start_combat_block()
        combat.start_combat(peer.account.player, target)
        combat.do_damage(peer.account.player, target, 0, "sap", False)
        combat.end_combat_block()
コード例 #11
0
ファイル: spells.py プロジェクト: csakoda/rdu
    def execute_spell(self, peer, args):

        #  Check in_combat
        if peer.account.player.fighting is not None and not self.in_combat:
            peer.account.player.send("You can't cast that spell in combat.\n\r")
            return

        #  Find target
        if self.target_state == _.TARGET_SELF_ONLY:
            target = peer.account.player
        elif self.target_state == _.TARGET_PREFER_SELF:
            try:
                target = mobile.get_mobile_in_room(args.split()[0], peer.account.player.get_room())
                if target == None:
                    peer.account.player.send("They aren't here.\n\r")
                    return
            except IndexError:
                target = peer.account.player
        elif self.target_state == _.TARGET_PREFER_FIGHTING:
            try:
                target = mobile.get_mobile_in_room(args.split()[0], peer.account.player.get_room())
                if target == None:
                    peer.account.player.send("They aren't here.\n\r")
                    return
            except IndexError:
                if peer.account.player.fighting is None:
                    peer.account.player.send("You aren't fighting anyone.\n\r")
                    return
                else:
                    target = peer.account.player.fighting
        elif self.target_state == _.TARGET_TARGET_ONLY:
            try:
                target = mobile.get_mobile_in_room(args.split()[0], peer.account.player.get_room())
                if target == None:
                    peer.account.player.send("They aren't here.\n\r")
                    return
            except IndexError:
                    peer.account.player.send("You must provide a target.\n\r")
                    return
        else:
            target = None

        combat.start_combat_block()
        if self.aggro:
            combat.start_combat(peer.account.player, target)
        if random.randint(0,1) == 5:  # -Rework- right now there's no chance of losing concentration
            self.lost_concentration(peer)
            return
        _.send_to_room_except("%s utters the words, '%s'.\n\r" % (peer.account.player.get_name(), self.words), \
                              peer.account.player.get_room(), [peer,])
        self.function(peer, args, target)
        combat.end_combat_block()
        peer.account.player.add_lag(self.lag)
コード例 #12
0
def do_flee(char, args):
    import combat
    if char.player.fighting is None:
        _.send_to_char(char, "You aren't fighting anyone.\n\r")
        return
    if char.player.get_room().random_exit() is None or random.randint(0,4) == 0:
        _.send_to_char(char, "PANIC! You couldn't escape!\n\r")
        return
    else:
        combat.start_combat_block()
        _.send_to_char(char, "You flee from combat!\n\r")  #  -Rework- to make you flee out of the room
        _.send_to_room_except("%s has fled!\n\r" % char.player.get_name(), char.player.get_room(), [char,])
        char.player.remove_from_combat()
        do_move(char, char.player.get_room().random_exit())
        combat.end_combat_block()
コード例 #13
0
ファイル: commands.py プロジェクト: csakoda/rdu
def do_flee(peer, args):
    import combat
    if peer.account.player.fighting is None:
        peer.account.player.send("You aren't fighting anyone.\n\r")
        return
    if peer.account.player.get_room().random_exit() is None or random.randint(0,4) == 0:
        peer.account.player.send("PANIC! You couldn't escape!\n\r")
        return
    else:
        combat.start_combat_block()
        peer.account.player.send("You flee from combat!\n\r")  #  -Rework- to make you flee out of the room
        _.send_to_room_except("%s has fled!\n\r" % peer.account.player.get_name(), peer.account.player.get_room(), [peer,])
        peer.account.player.remove_from_combat()
        do_move(peer, peer.account.player.get_room().random_exit())
        combat.end_combat_block()