コード例 #1
0
    def func(self):
        if not self.args:
            self.msg("You must provide a target for your spell.")
            return
        if ' ' in self.args:
            arg1, arg2 = self.args.split(' ', 1)
            playerA = self.caller.search(arg1)
            playerB = self.caller.search(arg2)
 
            # just in case we don't get a player target, we return if so
            if not playerA or not playerB:
                self.caller.msg("Couldn't find those players")
                return
            # this calls EvMenu with our menu. It imports from the
            # module we give it, in this case, our own module.
            # in practice you should store your menus somewhere else.
            EvMenu(self.caller, 'commands.spells',
                   startnode='node_get_1', # this is the initial node
                   player_a=playerA, # any data we give as kwargs is passed
                   player_b=playerB) # to the menu in caller.ndb._menutree
コード例 #2
0
ファイル: menu.py プロジェクト: Treatz/MobileFix
def flee(caller):
    caller.db.start_time = 99999999999999999999999
    if caller.db.attack_not:
        init_a = caller.db.dexterity + caller.db.wits + caller.db.blessed + caller.db.charisma
        caller.db.target.msg("|/|y%s doesn't want to fight." % caller)
    else:
        init_a = caller.db.dexterity + caller.db.wits + caller.db.blessed
    init_b = caller.db.target.db.dexterity + caller.db.target.db.wits
    init_a = init_a + roll_dice(1,10) 
    init_b = init_b + roll_dice(1,10)
    if(init_a > init_b or caller.db.target.db.conscious == 0 or caller.db.target.db.alive == 0):
        caller.msg("|/|yYou flee from combat!|/|/")
        caller.db.target.msg("|/|y%s flees from combat!|/|/" % caller)
        players = [con for con in caller.location.contents if con.has_player]
        for player in players:
            if not player.ndb.end_combat:
                player.msg("%s flees from combat." % caller.name)
        caller.db.target.ndb._menutree.close_menu()
        caller.ndb._menutree.close_menu()
        caller.ndb.end_combat = 0
        caller.db.target.ndb.end_combat = 0
    else:
        caller.msg("|yYou fail to flee from combat")
        caller.db.target.msg("|y%s fails to flee from combat" % caller)
        if(caller.db.target.db.weapon == 1):
            caller.msg("|/|g%s causes %i points of lethal damage to you." % (caller.db.target, damage))
            caller.msg("|/|gYou lose a total of %i health points." % (damage))
            caller.db.lethal = caller.db.lethal + damage
            caller.db.target.msg("|/|gYou deal %i points of lethal damage with your attack." % (damage))
            caller.db.target.msg("|/|g%s loses a total of %i hit points." % (caller, damaga))
        if(caller.db.target.db.weapon == 0):
            caller.msg("|/|g%s causes %i points of bashing damage to you." % (caller.db.target, damage))
            caller.msg("|/|gYou lose a total of %i health points." % (damage))
            caller.db.bashing = caller.db.bashing + damage
            caller.db.target.msg("|/|gYou deal %i points of bashing damage with your attack." % (damage))
            caller.db.target.msg("|/|g%s loses a total of %i hit points." % (caller, damage))
        EvMenu(caller, "typeclasses.menu", startnode="attack_node", auto_quit=False, cmd_on_exit=None)

    text = ""
    options = ()
    return text, options
コード例 #3
0
 def add_character(self, character):
     """Add combatant to handler"""
     dbref = character.id
     self.db.characters[dbref] = character
     self.db.action_count[dbref] = 0
     self.db.disconnected_turns[dbref] = 0
     self.db.turn_actions[dbref] = [{
         'card': None,
         'character': character,
         'target': [None]
     }]
     # set up back-reference
     self._init_character(character)
     if character in CardCharacter.objects.all(
     ) or character in Character.objects.all():
         EvMenu(character,
                'cardsystem.combat_handler',
                startnode='combat_menu',
                cmd_on_exit=None)
     elif character in NPC.objects.all() and len(self.db.characters) > 1:
         character.combat_action()
コード例 #4
0
ファイル: buggedmenu.py プロジェクト: bluetyson/Apendixie
    def func(self):
        print "Bug Menu started"
        self.caller.msg("Bug menu started")

        if self.lhs:
            food = self.lhs
        else:
            self.caller.msg("usage @cook [raw] <food>")
            return

        # Start Menu
        EvMenu(self.caller,
               "world.buggedmenu",
               startnode="men_start",
               cmdset_mergetype="Union", cmdset_priority=1,
               auto_quit=True, auto_look=True, auto_help=True,
               cmd_on_exit="look",
               persistent=False,
               food=food,
               # override=override
               )
コード例 #5
0
ファイル: npc.py プロジェクト: gridpunx-team/gridpunx
    def func(self):
        """
        Implements the command in a way which allows for adding new 
        NPCs with their own unique dialogue trees. This is accomplished 
        by passing a dynamically assigned module path to EvMenu. See 
        documentation for RealTalkingNPC for details about adding new NPCs.
        """
        
        # This is weird... but it works!
        dialogue_module = str(self.obj.typeclass_path.rstrip(self.obj.typename).rstrip("."))
        # This dynamically assigns the module path of the dialogue tree
        # based on the typeclass_path of the object it is assigned to.
        # Steps:
        # 1. Ensure it's a string.
        # 2. Remove the object's typename from the object's typeclass_path.
        # 3. Remove the remaining dot.

        # self.obj is the NPC object this command is defined on.
        self.caller.msg("(You walk up and talk to %s.)" % self.obj.key)
        
        # Initiate the menu by passing the object's module path to it.
        EvMenu(self.caller, dialogue_module, startnode="dialogue_start")
コード例 #6
0
    def func(self):
        account_caller = True
        char = self.caller
        mesg = ("Mercadia uses a method of rolling the dice to create account attributes. "
                "These attributes are: strength, dexterity, constitution, intelligence, "
                "wisdom, and charisma. Choose the order of your attributes from the most "
                "important to your character to the least important.\n\n"
                "An example is as follows: strength dexterity constitution intelligence "
                "wisdom charisma\n\n"
                "You will only be able to roll up to 25 times, so when you see a decent "
                "roll, you should accept it.", "You may only roll your stats once.")
        if char.traits.STR.actual > 5 or char.traits.INT.actual > 5 or char.traits.WIS.actual > 5 or \
           char.traits.DEX.actual > 5 or char.traits.CON > 5 or char.traits.CHA.actual > 5:
            return self.caller.msg(mesg[1])
        else:
            self.caller.msg(mesg[0])

        EvMenu(self.caller, "commands.setstats", startnode="menu_start",
               cmd_on_exit=None, persistent=False,
               stats={"STR": "Strength", "INT": "Intelligence", "WIS": "Wisdom",
                      "DEX": "Dexterity", "CON": "Constitution", "CHA": "Charisma"},
               choice=[], remaining_choices=[], rolls=[], roll_count=25)
コード例 #7
0
    def func(self):
        "Execute the menu"
        nodes = {
            "start": start,
            "username": username,
            "password": password,
            "create_account": create_account,
            "create_username": create_username,
            "create_password": create_password,
            "confirm_password": confirm_password,
            "email_address": email_address,
            "validate_account": validate_account,
        }

        menu = EvMenu(self.caller,
                      nodes,
                      startnode="start",
                      auto_quit=False,
                      cmd_on_exit=None,
                      node_formatter=_formatter,
                      input_parser=_input_no_digit,
                      persistent=True)
コード例 #8
0
ファイル: editplayer.py プロジェクト: solaxybat/startide
    def func(self):

        # Use Editplayer to set initial RP Variables

        if not self.caller.db.chargen:
            self.caller.db.chargen = False
        if not self.caller.db.fullname:
            self.caller.db.fullname = "None"
        if not self.caller.db.sex:
            self.caller.db.sex = "None"
        if not self.caller.db.race:
            self.caller.db.race = "None"
        if not self.caller.db.flight:
            self.caller.db.flight = False
        if not self.caller.db.scent:
            self.caller.db.scent = "None"
        if not self.caller.db.fullname:
            self.caller.db.fullname = "None"

        EvMenu(self.caller,
               "commands.editplayer",
               startnode="menu_start_node",
               node_formatter=node_formatter)
コード例 #9
0
ファイル: menu.py プロジェクト: Treatz/MobileFix
def skip_defend(caller):
    caller.db.start_time = 99999999999999999999999
    caller.msg("|/|rYou have been hit by %s.|/" % caller.db.target)
    players = [con for con in caller.location.contents if con.has_player]
    for player in players:
        if not player.ndb.end_combat:
            player.msg("%s has been hit by %s." % (caller.name, caller.db.target))
    if(caller.db.conscious == 0):
        caller.db.target.msg("|/|r%s is unconscious.|/" % caller)
        players = [con for con in caller.location.contents if con.has_player]
    if(caller.db.conscious == 1):
        caller.db.target.msg("|/|r%s has skipped his turn.|/" % caller)

    if(caller.db.conscious == 0 and caller.db.alive == 1):
        text = "|/|rYou are unconscious!"
    if(caller.db.conscious == 1 or caller.db.alive == 0):
        text = "|/|r You have skipped your turn!"
    EvMenu(caller.db.target, "typeclasses.menu", startnode="attack_node",auto_quit=False, cmd_on_exit=None)

    if(caller.db.alive == 0):
        caller.db.conscious = 1
        caller.msg("|rYou are dead!")
        caller.db.target.msg("|/|r%s is dead!"% caller)
        caller.ndb._menutree.close_menu()
        caller.db.target.ndb._menutree.close_menu()
	corpse2 = create_object(key="Corpse", location = caller.location)
        corpse2.attributes.add("target", caller.db.target)
        corpse2.attributes.add("lastname", caller)
	corpse2.db.description = "A bloody mess of flesh and broken bones."
       	print(caller.location)
	text = ""
        options = ()


    options = {"key": "_default",
               "goto": "wait"}
    return text, options
コード例 #10
0
ファイル: menu.py プロジェクト: Treatz/MobileFix
def flee_attack(caller):
    caller.db.start_time = 99999999999999999999999
    if caller.db.attack_not:
        init_a = caller.db.dexterity + caller.db.wits + caller.db.blessed + caller.db.charisma
        caller.db.target.msg("|/|y%s doesn't want to fight." % caller)
    else:
        init_a = caller.db.dexterity + caller.db.wits + caller.db.blessed
    init_b = caller.db.target.db.dexterity + caller.db.target.db.wits
    init_a = init_a + roll_dice(1,10) 
    init_b = init_b + roll_dice(1,10)
    if(init_a > init_b):
        caller.msg("|/|yYou flee from combat!|/|/")
        caller.db.target.msg("|/|y%s flees from combat!|/|/" % caller)
        players = [con for con in caller.location.contents if con.has_player]
        for player in players:
            if not player.ndb.end_combat:
                player.msg("%s flees from combat." % caller.name)
        caller.ndb._menutree.close_menu()
        if(caller.db.target.ndb._menutree):
            caller.db.target.ndb._menutree.close_menu()
        caller.ndb.end_combat = 0
        caller.db.target.ndb.end_combat = 0
        caller.execute_cmd('look')
        caller.db.target.execute_cmd('look')
    else:
        caller.msg("|/|yYou couldn't flee")
        caller.db.target.msg("|/|y%s couldn't flee" % caller)
        EvMenu(caller.db.target, "typeclasses.menu", startnode="attack_node", auto_quit=False, cmd_on_exit=None)
        text = ""
        options = ({"key": "skip",
                "goto": "skip_attack"})
        return text, options

    text = ""
    options = ()
    return text, options
コード例 #11
0
ファイル: account.py プロジェクト: Vikka/TerazurEngine
 def func(self):
     caller = self.caller
     EvMenu(caller, "world.main_menu", cmd_on_exit="regarder")
コード例 #12
0
ファイル: cast.py プロジェクト: Treatz/Chargen-Update
 def func(self):
     EvMenu(self.caller, 'commands.cast', startnode='node_get_1')
コード例 #13
0
ファイル: chargen.py プロジェクト: jswofford/ainneve
    def func(self):
        "create the new character"
        player = self.player
        session = self.session
        if not self.args:
            self.msg("Usage: @charcreate <charname>")
            return
        key = self.args.strip()

        charmax = _MAX_NR_CHARACTERS if _MULTISESSION_MODE > 1 else 1

        if not player.is_superuser and \
            (player.db._playable_characters and
                len(player.db._playable_characters) >= charmax):
            self.msg("You may only create a maximum of {} characters.".format(
                charmax))
            return

        # create the character
        from evennia.objects.models import ObjectDB

        start_location = ObjectDB.objects.get_id(settings.START_LOCATION)
        default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
        typeclass = settings.BASE_CHARACTER_TYPECLASS
        permissions = settings.PERMISSION_PLAYER_DEFAULT

        # check whether a character already exists
        new_character = None
        candidates = search.objects(
            key, typeclass='typeclasses.characters.Character')
        if candidates:
            for c in candidates:
                if c.access(player, 'puppet'):
                    new_character = c
                    break

        startnode = "menunode_welcome_archetypes"
        if not new_character:

            new_character = create.create_object(typeclass,
                                                 key=key,
                                                 location=None,
                                                 home=default_home,
                                                 permissions=permissions)
            # only allow creator (and immortals) to puppet this char
            new_character.locks.add(
                ("puppet:id({}) or pid({}) "
                 "or perm(Immortals) or pperm(Immortals)").format(
                     new_character.id, player.id))
            player.db._playable_characters.append(new_character)

        else:
            if new_character.db.chargen_complete:
                self.msg(
                    ("{name} has already completed character "
                     "generation. Use @ic {name} to puppet.").format(
                         name=new_character.key if ' ' not in new_character.
                         key else '"{}"'.format(new_character.key)))
                return
            if new_character.db.archetype:
                startnode = "menunode_allocate_traits"
                if (new_character.db.focus or
                    (not new_character.db.focus
                     and validate_primary_traits(new_character.traits)[0])):
                    startnode = "menunode_races"
                    if new_character.db.race:
                        startnode = "menunode_allocate_mana"
                        if (new_character.traits.BM.base +
                                new_character.traits.WM.base
                                == new_character.traits.MAG.actual
                                and len(new_character.skills.all) > 0):
                            startnode = "menunode_allocate_skills"
                            if ('escape' in new_character.skills.all
                                    and not hasattr(
                                        new_character.skills.escape, 'minus')):
                                startnode = "menunode_equipment_cats"

        session.new_char = new_character

        def finish_char_callback(session, menu):
            char = session.new_char
            if char.db.chargen_complete:
                char.location = start_location
                player.puppet_object(session, char)

        EvMenu(session,
               "world.chargen",
               startnode=startnode,
               cmd_on_exit=finish_char_callback)
コード例 #14
0
ファイル: menu.py プロジェクト: dimaguy/NOW
 def func(self):
     EvMenu(self.caller,
            'commands.menu',
            startnode='menu_main',
            cmd_on_exit=None,
            persistent=False)
コード例 #15
0
 def func(self):
     EvMenu(self.caller,
            "commands.attributes",
            startnode="attributes",
            cmdset_mergetype="Replace")
コード例 #16
0
 def func(self):
     "Execute the menu"
     EvMenu(self.caller, "server.conf.menu_login",
            startnode="start", auto_look=False, auto_quit=False,
            cmd_on_exit=None, node_formatter=_formatter)
コード例 #17
0
 def func(self):
     EvMenu(caller, "world.mymenu")
コード例 #18
0
ファイル: menu.py プロジェクト: Treatz/MobileFix
def block(caller):
	test = caller.db.dexterity + caller.db.brawl + caller.db.blessed
	soak = caller.db.stamina + caller.db.blessed
	counter = 0
	defendpoints = 0
	while (counter < test):
		counter = counter + 1
		roll = roll_dice(1, 10)
		if (roll >= 6):
			defendpoints = defendpoints + 1

	counter = 0
	soakpoints = 0
	while (counter < soak):
		counter = counter + 1
		roll = roll_dice(1,10)
		if (roll >= 6):
			soakpoints = soakpoints + 1
	dmg = damage
	caller.db.start_time = 99999999999999999999999
	if (defendpoints > 0):
		tst = damage2
		dmg2 = damage
		cnt2 = 0
		while (cnt2 < tst):
			cnt2 = cnt2 + 1
			roll = roll_dice(1, 10)
			if (roll >= 6):
				dmg = dmg + 1

		reduced =  dmg - defendpoints
		if(reduced < 0):
			reduced = 0
		if(defendpoints >= dmg2):
			defendpoints = dmg2
			reduced = 0

		if(caller.db.target.db.weapon == 0 and caller.db.target.db.kinetic == 0):
			caller.msg("|/|gYou block %i out of %i of %s's attack points." % (defendpoints, dmg2, caller.db.target))
			caller.msg("|/|g%s causes %i points of damage to you." % (caller.db.target, reduced))
			if (soakpoints > reduced):
				soakpoints = reduced
			if (soakpoints > 0):
				caller.msg("|/|gYou soak %i out of %i points of bashing damage." % (soakpoints, reduced))
			if (reduced - soakpoints > 0):
				caller.msg("|/|gYou lose a total of %i health points." % (reduced - soakpoints))
				caller.db.bashing = caller.db.bashing + (reduced - soakpoints)
			caller.db.target.msg("|/|g%s blocks %i points of your attack." % (caller, defendpoints))
			caller.db.target.msg("|/|gYou deal %i points of damage with your attack." % (reduced))
	
			if(soakpoints>0):
				caller.db.target.msg("|/|g%s soaks %i points of damage from your attack." % (caller, soakpoints))
			if(reduced-soakpoints > 0):
				caller.db.target.msg("|/|g%s loses a total of %i hit points." % (caller, reduced - soakpoints))

		if(caller.db.target.db.weapon == 1 or caller.db.target.db.kinetic == 1):
			caller.msg("|/|gYou can't block %s's attack points." % (caller.db.target))
			caller.msg("|/|g%s causes %i points of lethal damage to you." % (caller.db.target, dmg))
			caller.db.lethal = caller.db.lethal + dmg
			caller.db.target.msg("|/|g%s fails to block your attack." % (caller))
			caller.db.target.msg("|/|gYou deal %i points of lethal damage." % (dmg))
			
	else:
		caller.msg("|/|rYou have been hit by %s." % caller.db.target)
		caller.db.target.msg("|/|r%s fails to block your attack." % caller)

		if(caller.db.target.db.weapon == 0 and caller.db.target.db.kinetic == 0):
			caller.msg("|/|g%s causes %i points of damage to you." % (caller.db.target, dmg))
			caller.msg("|/|gYou soak %i out of %i points of bashing damage." % (soakpoints, dmg))
			caller.msg("|/|gYou lose a total of %i health points." % (dmg - soakpoints))
			caller.db.bashing = caller.db.bashing + (dmg - soakpoints)
			caller.db.target.msg("|/|gYou deal %i points of damage with your punch." % (dmg))
			caller.db.target.msg("|/|g%s soaks %i points of damage from your punch." % (caller, soakpoints))
			caller.db.target.msg("|/|g%s loses a total of %i hit points." % (caller, dmg - soakpoints))

		if(caller.db.target.db.weapon == 1 or caller.db.target.db.kinetic == 1):
			caller.msg("|/|g%s causes %i points of lethal damage to you." % (caller.db.target, dmg))
			caller.msg("|/|gYou lose a total of %i health points." % (dmg))
			caller.db.lethal = caller.db.lethal + dmg
			caller.db.target.msg("|/|gYou deal %i points of lethal damage with your attack." % (dmg))
			caller.db.target.msg("|/|g%s loses a total of %i hit points." % (caller, dmg))


	EvMenu(caller, "typeclasses.menu", startnode="attack_node", auto_quit=False, cmd_on_exit=None)
	text = ""
	options = ({"key": "skip",
		"goto": "skip_attack"})
	
	if(caller.db.alive == 0 or caller.db.target.db.alive == 0):
                caller.ndb.end_combat = 0
                caller.db.target.ndb.end_combat = 0
		caller.db.conscious = 1
		caller.db.target.db.conscious = 1
		caller.msg("|rYou are dead!")
		caller.db.target.msg("|r%s is dead!" % caller)
                players = [con for con in caller.location.contents if con.has_player]
                for player in players:
                    if not player.ndb.end_combat:
                        player.msg("%s is dead." % caller.name)
		caller.db.target.ndb._menutree.close_menu()
		caller.ndb._menutree.close_menu()
		text = ""
		options = ()

	return text, options
コード例 #19
0
    def func(self):
        "create the new character"
        account = self.account
        session = self.session
        if not self.args:
            self.msg("Usage: @charcreate <charname>")
            return
        key = self.args.strip()

        charmax = _MAX_NR_CHARACTERS if _MULTISESSION_MODE > 1 else 1

        if not account.is_superuser and \
            (account.db._playable_characters and
                len(account.db._playable_characters) >= charmax):
            self.msg("You may only create a maximum of {} characters.".format(
                charmax))
            return

        # create the character
        from evennia.objects.models import ObjectDB

        start_location = search.objects('Limbo')
        start_location = start_location[0] if start_location \
            else ObjectDB.objects.get_id(settings.START_LOCATION)

        home = search.objects('Limbo')
        home = home[0] if home \
            else ObjectDB.objects.get_id(settings.DEFAULT_HOME)

        typeclass = settings.BASE_CHARACTER_TYPECLASS
        permissions = settings.PERMISSION_ACCOUNT_DEFAULT

        # check whether a character already exists
        new_character = None
        candidates = search.objects(
            key, typeclass='typeclasses.characters.Character')

        if candidates:
            for c in candidates:
                if c.access(account, 'puppet'):
                    new_character = c
                    break

        startnode = "menunode_chargen_welcome"
        if not new_character:

            new_character = create.create_object(typeclass,
                                                 key=key,
                                                 location=None,
                                                 home=home,
                                                 permissions=permissions)
            # only allow creator (and immortals) to puppet this char
            new_character.locks.add(
                ("puppet:id({}) or pid({}) "
                 "or perm(Immortals) or pperm(Immortals)").format(
                     new_character.id, account.id))
            account.db._playable_characters.append(new_character)

        else:
            if new_character.db.chargen_complete:
                self.msg(
                    ("{name} has already completed character "
                     "generation. Use @ic {name} to puppet.").format(
                         name=new_character.key if ' ' not in new_character.
                         key else '"{}"'.format(new_character.key)))
                return
        session.new_char = new_character

        def finish_char_callback(session, menu):
            char = session.new_char
            if char.db.chargen_complete:
                char.location = start_location
                account.puppet_object(session, char)
#                self.execute_cmd("help getting started")

        EvMenu(session,
               "world.chargen",
               startnode=startnode,
               cmd_on_exit=finish_char_callback)
コード例 #20
0
ファイル: construct.py プロジェクト: Phayte/origins
 def func(self):
     EvMenu(self.caller, "menus.constructs", startnode="start")
コード例 #21
0
ファイル: greet.py プロジェクト: tricuspa/current
 def func(self):
     EvMenu(self.caller,
            'commands.greet',
            startnode='menu_start_node',
            cmd_on_exit=None,
            persistent=False)
コード例 #22
0
 def func(self):
     EvMenu(self.caller, "world.builderreview", startnode="start", cmdset_mergetype="Replace", cmdset_priority=1, auto_quit=True, cmd_on_exit="look", persistent=False)
コード例 #23
0
ファイル: planet.py プロジェクト: Puciek/upfire
 def func(self):
     EvMenu(self.caller,
            "world.planet_administration",
            startnode="main_menu",
            cmdset_mergetype="Union")
コード例 #24
0
def block(caller):
    test = caller.db.dexterity + caller.db.brawl
    soak = caller.db.stamina
    counter = 0
    defendpoints = 0
    while (counter < test):
        counter = counter + 1
        roll = roll_dice(1, 10)
        if (roll >= 6):
            defendpoints = defendpoints + 1

    counter = 0
    soakpoints = 0
    while (counter < soak):
        counter = counter + 1
        roll = roll_dice(1, 10)
        if (roll >= 6):
            soakpoints = soakpoints + 1

    caller.db.start_time = 99999999999999999999999
    if (defendpoints > 0):
        tst = damage2
        dmg2 = damage
        dmg = damage
        cnt2 = 0
        while (cnt2 < tst):
            cnt2 = cnt2 + 1
            roll = roll_dice(1, 10)
            if (roll >= 6):
                dmg = dmg + 1

        reduced = dmg - defendpoints
        if (reduced < 0):
            reduced = 0
        if (defendpoints >= dmg2):
            defendpoints = dmg2
            reduced = 0

        if (caller.db.target.db.weapon == 0):
            caller.msg("|/|gYou block %i out of %i of %s's attack points." %
                       (defendpoints, dmg2, caller.db.target))
            caller.msg("|/|g%s causes %i points of damage to you." %
                       (caller.db.target, reduced))
            if (soakpoints > 0):
                caller.msg(
                    "|/|gYou soak %i out of %i points of bashing damage." %
                    (soakpoints, reduced))
            if (reduced - soakpoints > 0):
                caller.msg("|/|gYou lose a total of %i health points." %
                           (reduced - soakpoints))
                caller.db.bashing = caller.db.bashing + (reduced - soakpoints)
            caller.db.target.msg("|/|g%s blocks %i points of your attack." %
                                 (caller, defendpoints))
            caller.db.target.msg(
                "|/|gYou deal %i points of damage with your attack." %
                (reduced))

            if (soakpoints > 0):
                caller.db.target.msg(
                    "|/|g%s soaks %i points of damage from your punch." %
                    (caller, soakpoints))
            if (reduced - soakpoints > 0):
                caller.db.target.msg("|/|g%s loses a total of %i hit points." %
                                     (caller, reduced - soakpoints))

        if (caller.db.target.db.weapon == 1):
            caller.msg("|/|gYou cannot block %s's attack points." %
                       (caller.db.target))
            caller.msg("|/|g%s causes %i points of lethal damage to you." %
                       (caller.db.target, dmg2))
            caller.db.lethal = caller.db.lethal + dmg2
            caller.db.target.msg("|/|g%s can't block your attack." %
                                 (caller, defendpoints))
            caller.db.target.msg("|/|gYou deal %i points of lethal damage." %
                                 (dmg2))

    else:
        caller.msg("|/|rYou have been hit by %s." % caller.db.target)
        caller.db.target.msg("|/|r%s fails to dodge your attack." % caller)

    EvMenu(caller,
           "typeclasses.menu",
           startnode="attack_node",
           auto_quit=False,
           cmd_on_exit=None)
    text = ""
    options = ({"key": "skip", "goto": "skip_attack"})
    return text, options
コード例 #25
0
 def func(self):
     lhs = self.lhs
     #In the case of vampires both psychic and kindred, the target they're attempting to feed ong.
     rhs = self.rhs
     #In the case of actual, undead vampires the amount of blood or vitae they are attempting to steal.
     command = self.cmdstring
     switches = self.switches
     if command == "+feed":
         if not self.caller.db.template.lower() == 'vampire':
             self.caller.msg("Only vampires can feed from humans!")
             return
         if lhs and rhs:
             try:
                 if int(rhs) > self.caller.db.powerstat:
                     self.caller.msg("You can't drain that much vitae from someone at once!")
                     return
             except TypeError:
                 self.caller.msg("Invalid amount of vitae to drain.")
                 return
             for obj in self.caller.location.contents:
                 if inherits_from(obj, DefaultCharacter):
                     if obj.has_account():
                         obj.msg(self.caller + " is trying to feed on you! Do you accept?")
                         if EvMenu(obj,'evennia.utils.evmenu',startnode='BloodQuery'):
                             self.caller.PoolGain('Vitae',int(rhs))
                             if obj.db.template == 'Vampire':
                                 self.caller.msg('You feed on ' + obj.name + ' draining ' + rhs + ' of their vitae!')
                                 obj.PoolSpend('Vitae',int(rhs))
                                 return
                             else:
                                 self.caller.msg('You drain ' + rhs + ' points worth of blood from ' + obj.name + '!')
                                 obj.Damage(2,int(rhs))
                                 return
                         
         for feature in self.caller.location().db.features:
             if feature.name.lower() == 'prey':
                 break
             self.caller.msg("There's no prey pool here to feed from!")
             return
         if switches[0] == 'ambush':
             dicepool = self.caller.db.attributes['Strength'] + self.caller.db.socskills['Streetwise']
             if self.caller.db.socskills['Streetwise'] == 0:
                 dicepool -= 1
         elif switches[0] == 'seduce':
             dicepool = self.caller.db.attributes['Manipulation'] + self.caller.db.socskills['Persuasion']
             if self.caller.db.socskills['Persuasion'] == 0:
                 dicepool -= 1
         elif switches[0] == 'animal':
             if self.caller.db.powerstat >= 3:
                 self.caller.msg('Your blood is too potent to feed from animals!')
                 return
             else:
                 dicepool = self.caller.db.attributes['Wits'] + self.caller.db.physskills['Survival'] + 1
                 if self.caller.db.physskills['Survival'] == 0:
                     dicepool -= 1
         else:
             self.caller.msg("Invalid feeding method.")
             return
         successes = self.DiceRoll(dicepool)
         if successes == -1:
             self.caller.msg("You've had a dramatic failure feeding, and a job has been created accordingly.")
             self.SubmitJob('Vampire feeding dramatic failure: ' + self.caller.name,self.caller.location,self.caller.id)
         elif successes == 0:
             self.caller.msg("Try as you might, you fail to find prey.")
         else:
             self.caller.msg("You gain " + str(successes) + " vitae from hunting!")
     if command == '+drain':
         for merit in self.caller.db.meritlist:
             if merit[0] == 'Psychic Vampirism':
                 break
             self.caller.msg("You can't drain life force if you're not a psychic vampire!")
             return
         for feature in self.caller.location().db.features:
             if feature.name.lower() == 'prey':
                 break
             self.caller.msg("There's no prey pool to drain from!")
             return
         if switches[0] == 'ambush':
             dicepool = self.caller.db.attributes['Strength'] + self.caller.db.socskills['Streetwise'] - 3
             if self.caller.db.socskills['Streetwise'] == 0:
                 dicepool -= 1
         elif switches[0] == 'seduce':
             dicepool = self.caller.db.attributes['Manipulation'] + self.caller.db.socskills['Persuasion'] - 3
             if self.caller.db.socskills['Persuasion'] == 0:
                 dicepool -= 1
         elif switches[0] == 'skim':
             dicepool = self.caller.db.attributes['Wits'] + self.caller.db.mentskills['Occult'] - 3
             if self.caller.db.mentskills['Occult'] == 0:
                 dicepool -= 3
         for merit in self.caller.db.meritlist:
             if merit[0] == 'Breath Stealer':
                 if int(merit[1]) >= 2:
                     dicepool += 2
                 else:
                     dicepool += 1
                 break
             successes = self.DiceRoll(dicepool)
         if successes == -1:
             self.caller.msg("You've had a dramatic failure whilst draining, and a job has been created accordingly.")
             self.SubmitJob('Psychic Vampire feeding dramatic failure: ' + self.caller.name,self.caller.location,self.caller.id)
         elif successes == 0:
             self.caller.msg("Try as you might, you fail to find prey.")
         else:
             self.caller.msg("You gain " + str(successes) + " ephemera from hunting!")
     if command == '+sate':
         if not self.caller.db.template == 'Beast':
             self.caller.msg('Only beasts can sate their Horrors!')
             return