def __init__(self, code=""): super(Mob, self).__init__() BehaviourUpdaterSuperclass.__init__(self) self.code = "" self.prototype = None if code: self.reinit_code(code) copy_existing_attributes(self.prototype, self, except_these_attrs=["code"]) self.after_copy_existing_attributes() # Eventuale inizializzazione dei punti if self.max_life == 0: self.max_life = config.starting_points if self.max_mana == 0: self.max_mana = config.starting_points if self.max_vigour == 0: self.max_vigour = config.starting_points if self.life == 0: self.life = self.max_life if self.mana == 0: self.mana = self.max_mana if self.vigour == 0: self.vigour = self.max_vigour if self.hand == HAND.NONE: self.hand = self.hand.randomize() # Variabili proprie di una istanza di mob: self.area = None self.attack = 1 self.defense = 1 self.speaking = Element( LANGUAGE.COMMON ) # Indica con quale linguaggio sta attualmente parlando il mob self.style = Element( STYLE.NONE) # Style di combattimento che sta utilizzando self.experience = 0 # Esperienza accumulata prima di poter livellare self.mount = None # Indica quale mob o pg sta cavalcando self.mounted_by = None # Indica da quali mob o pg è cavalcato self.specials = { } # E' una lista di variabili speciali, possono essere utilizzate come delle flags, vengono aggiunte di solito nei gamescript self.reply = None # Entità a cui si può replicare # self.tracking = Track() # Serve quando il mob inizia a tracciare e cacciare una preda fuggita self.last_fight_time = None self.last_death_time = None # Contatori di statistica self.defeat_from_mob_counter = 0 # Conteggio delle sconfitte self.defeat_from_item_counter = 0 # Conteggio delle sconfitte self.defeat_from_player_counter = 0 # Conteggio delle sconfitte self.death_from_player_counter = 0 # Conteggio delle sconfitte self.mob_defeated_counter = 0 # Conteggio delle vittorie sui mob self.item_defeated_counter = 0 # Conteggio degli oggetti distrutti self.player_defeated_counter = 0 # Conteggio delle vittorie sui giocatori self.player_killed_counter = 0 # Conteggio delle volte che viene ucciso un giocatore check_trigger(self, "on_init", self)
def on_midnight(test_tessi): location = test_tessi.location copy_existing_attributes(BARBAGIANNI_PROTO, test_tessi, except_these_attrs=["code", "items", "mobs", "players"]) test_tessi.after_copy_existing_attributes() test_tessi.location = location print "villaggio-zingaro_mob_test-tessi - >>> On Sunset done <<<" location.act("\nLa tessitrice, lacerata dal dolore, si è trasformata in un rapace.")
def on_sunrise(test_tessi): # La copia di attributi copia anche la variabile location # e tale variabile è None per mob non in game location = test_tessi.location copy_existing_attributes(TESSITRICE_PROTO, test_tessi, except_these_attrs=["code", "items", "mobs", "players"]) test_tessi.after_copy_existing_attributes() test_tessi.location = location print "villaggio-zingaro_mob_test-tessi - >>> On Sunrise done <<<" location.act("\nIl fiero rapace, straziato dal dolore, si è trasformato...")
def __init__(self, code=""): super(Item, self).__init__() BehaviourUpdaterSuperclass.__init__(self) self.code = "" self.prototype = None if code: self.reinit_code(code) copy_existing_attributes(self.prototype, self, except_these_attrs=["code"]) self.after_copy_existing_attributes() # Variabili proprie di una istanza di oggetto: self.area = None self.experience = 0 # Esperienza accumulata prima di poter livellare self.specials = {} # E' una lista di variabili speciali, possono essere utilizzate come delle flags, vengono aggiunte di solito nei gamescript check_trigger(self, "on_init", self)
def __init__(self, code=""): super(Item, self).__init__() BehaviourUpdaterSuperclass.__init__(self) self.code = "" self.prototype = None if code: self.reinit_code(code) copy_existing_attributes(self.prototype, self, except_these_attrs=["code"]) self.after_copy_existing_attributes() # Variabili proprie di una istanza di oggetto: self.area = None self.experience = 0 # Esperienza accumulata prima di poter livellare self.specials = { } # E' una lista di variabili speciali, possono essere utilizzate come delle flags, vengono aggiunte di solito nei gamescript check_trigger(self, "on_init", self)
def copy(self, to_obj=None, avoid_volatiles=False): if not to_obj: to_obj = MaterialPercentage() copy_existing_attributes(self, to_obj, avoid_volatiles=avoid_volatiles) return to_obj
def copy(self, to_obj=None, avoid_volatiles=False): if not to_obj: to_obj = Affect(self.type) copy_existing_attributes(self, to_obj, avoid_volatiles=avoid_volatiles) return to_obj
def copy(self, to_obj=None, avoid_volatiles=False): if not to_obj: to_obj = Element(self.enum_element) copy_existing_attributes(self, to_obj, avoid_volatiles=avoid_volatiles) return to_obj
def create_handler(entity, argument, command_name, table_name, can_create_multiple=False): if not entity: log.bug("entity non è un parametro valido: %r" % entity) return False if not command_name: log.bug("command_name non è un parametro valido: %r" % command_name) return False if not table_name: log.bug("table_name non è un parametro valido: %r" % table_name) return False # ------------------------------------------------------------------------- if not argument: syntax = get_command_syntax(entity, command_name) entity.send_output(syntax, break_line=False) return False if can_create_multiple: quantity, argument = quantity_argument(argument) else: quantity = 1 target = None if table_name == "players": target = search_online_player(argument, only_exact=True) if not target: target = entity.find_proto(argument, entity_tables=[table_name]) if not target: entity.send_output( "Non è stato trovato nessun %s con argomento [green]%s[close]." % (table_name, argument)) return False if quantity == 0: quantity = target.quantity if not target.IS_PLAYER and target.max_global_quantity > 0 and target.current_global_quantity + quantity > target.max_global_quantity: if entity.trust == TRUST.IMPLEMENTOR: entity.send_to_admin( "Ti è possibile iniettare in gioco %s nonostante questo raggiungerà il suo MaxGlobalQuantity di %d" % (target.get_name(looker=entity), target.max_global_quantity)) else: entity.send_output( "Non ti è possibile iniettare in gioco questa entità perché ha già raggiunto il suo MaxGlobalQuantity di %d" % target.max_global_quantity) return False if target.IS_PLAYER: result = Mob("limbo_mob_clone-pg") copy_existing_attributes(target, result, except_these_attrs=["code", "prototype"]) result.short = result.name # (TD) creazione dinamica della short, un po' come la long result.incognito = False elif target.IS_MOB: result = Mob(target.code) elif target.IS_ITEM: result = Item(target.code) else: log.bug("Entità base non valida: %s" % target.code) entity.send_output("C'è stato un'errore nell'esecuzione del comando.") return False # Se l'oggetto è uno dell'area rip avrà il tag %material da dover sostituire if "%material" in result.short: result.short.replace("%material", "qualcosa") if "%material" in result.short_night: result.short_night.replace("%material", "qualcosa") if "%material" in result.name: result.name.replace("%material", "qualcosa") result.quantity = quantity result.inject(entity) if entity == target: entity.act("Crei dal nulla una copia di te stess$O.", TO.ENTITY, target) entity.act("$n crea dal nulla una copia di se stess$O.", TO.OTHERS, target) elif entity.location == target.location: entity.act("Crei dal nulla una copia di $N.", TO.ENTITY, target) entity.act( "$n crea dal nulla una copia di $N, ma ora qual'è quello vero?", TO.OTHERS, target) entity.act("$n crea dal nulla una copia di te stess$O!", TO.TARGET, target) else: entity.act("Crei dal nulla una copia di $N.", TO.ENTITY, target) entity.act("$n crea dal nulla una copia di $N.", TO.OTHERS, target) return True
def copy(self, to_obj=None, avoid_volatiles=False): if not to_obj: to_obj = SwallowableGenericType() copy_existing_attributes(self, to_obj, avoid_volatiles=avoid_volatiles) return to_obj
def create_handler(entity, argument, command_name, table_name, can_create_multiple=False): if not entity: log.bug("entity non è un parametro valido: %r" % entity) return False if not command_name: log.bug("command_name non è un parametro valido: %r" % command_name) return False if not table_name: log.bug("table_name non è un parametro valido: %r" % table_name) return False # ------------------------------------------------------------------------- if not argument: syntax = get_command_syntax(entity, command_name) entity.send_output(syntax, break_line=False) return False if can_create_multiple: quantity, argument = quantity_argument(argument) else: quantity = 1 target = None if table_name == "players": target = search_online_player(argument, only_exact=True) if not target: target = entity.find_proto(argument, entity_tables=[table_name]) if not target: entity.send_output("Non è stato trovato nessun %s con argomento [green]%s[close]." % (table_name, argument)) return False if quantity == 0: quantity = target.quantity if not target.IS_PLAYER and target.max_global_quantity > 0 and target.current_global_quantity + quantity > target.max_global_quantity: if entity.trust == TRUST.IMPLEMENTOR: entity.send_to_admin("Ti è possibile iniettare in gioco %s nonostante questo raggiungerà il suo MaxGlobalQuantity di %d" % ( target.get_name(looker=entity), target.max_global_quantity)) else: entity.send_output("Non ti è possibile iniettare in gioco questa entità perché ha già raggiunto il suo MaxGlobalQuantity di %d" % target.max_global_quantity) return False if target.IS_PLAYER: result = Mob("limbo_mob_clone-pg") copy_existing_attributes(target, result, except_these_attrs=["code", "prototype"]) result.short = result.name # (TD) creazione dinamica della short, un po' come la long result.incognito = False elif target.IS_MOB: result = Mob(target.code) elif target.IS_ITEM: result = Item(target.code) else: log.bug("Entità base non valida: %s" % target.code) entity.send_output("C'è stato un'errore nell'esecuzione del comando.") return False # Se l'oggetto è uno dell'area rip avrà il tag %material da dover sostituire if "%material" in result.short: result.short.replace("%material", "qualcosa") if "%material" in result.short_night: result.short_night.replace("%material", "qualcosa") if "%material" in result.name: result.name.replace("%material", "qualcosa") result.quantity = quantity result.inject(entity) if entity == target: entity.act("Crei dal nulla una copia di te stess$O.", TO.ENTITY, target) entity.act("$n crea dal nulla una copia di se stess$O.", TO.OTHERS, target) elif entity.location == target.location: entity.act("Crei dal nulla una copia di $N.", TO.ENTITY, target) entity.act("$n crea dal nulla una copia di $N, ma ora qual'è quello vero?", TO.OTHERS, target) entity.act("$n crea dal nulla una copia di te stess$O!", TO.TARGET, target) else: entity.act("Crei dal nulla una copia di $N.", TO.ENTITY, target) entity.act("$n crea dal nulla una copia di $N.", TO.OTHERS, target) return True
def copy(self, to_obj=None, avoid_volatiles=False): if not to_obj: to_obj = ExtraDescription() copy_existing_attributes(self, to_obj, avoid_volatiles=avoid_volatiles) return to_obj
def copy(self, to_obj=None, avoid_volatiles=False): if not to_obj: to_obj = Weapon() copy_existing_attributes(self, to_obj, avoid_volatiles=avoid_volatiles) return to_obj
def copy(self, to_obj=None, avoid_volatiles=False): if not to_obj: to_obj = Buyable() copy_existing_attributes(self, to_obj, avoid_volatiles=avoid_volatiles) return to_obj