コード例 #1
0
 def die(self, cause=None):
     if cause == ewcfg.cause_busted:
         self.busted = True
     else:
         self.busted = False  # reset busted state on normal death; potentially move this to ewspooky.revive
         self.life_state = ewcfg.life_state_corpse
         ewstats.increment_stat(user=self,
                                metric=ewcfg.stat_lifetime_deaths)
         ewstats.change_stat(user=self,
                             metric=ewcfg.stat_lifetime_slimeloss,
                             n=self.slimes)
         if cause != ewcfg.cause_killing and cause != ewcfg.cause_suicide:
             ewstats.increment_stat(user=self,
                                    metric=ewcfg.stat_lifetime_pve_deaths)
     self.slimes = 0
     self.poi = ewcfg.poi_id_thesewers
     self.bounty = 0
     self.totaldamage = 0
     self.slimelevel = 1
     self.hunger = 0
     self.inebriation = 0
     self.ghostbust = False
     # Clear weapon and weaponskill.
     self.weapon = ""
     self.weaponskill = 0
     ewutils.weaponskills_clear(id_server=self.id_server,
                                id_user=self.id_user)
     ewstats.clear_on_death(id_server=self.id_server, id_user=self.id_user)
     ewitem.item_destroyall(id_server=self.id_server, id_user=self.id_user)
コード例 #2
0
ファイル: ew.py プロジェクト: seaniman/endless-war
	def die(self, cause = None):
		time_now = int(time.time())

		ewutils.end_trade(self.id_user)

		resp_cont = ewutils.EwResponseContainer(id_server = self.id_server)

		client = ewcfg.get_client()
		server = client.get_server(self.id_server)

		deathreport = ''
		
		# remove ghosts inhabiting player
		self.remove_inhabitation()

		# Make The death report
		deathreport = ewutils.create_death_report(cause = cause, user_data = self)
		resp_cont.add_channel_response(ewcfg.channel_sewers, deathreport)

		poi = ewcfg.id_to_poi.get(self.poi)
		if cause == ewcfg.cause_weather:
			resp_cont.add_channel_response(poi.channel, deathreport)

		# Grab necessary data for spontaneous combustion before stat reset
		explosion_block_list = [ewcfg.cause_leftserver, ewcfg.cause_cliff]
		user_hasCombustion = False
		if (cause not in explosion_block_list) and (poi.pvp):
			if ewcfg.mutation_id_spontaneouscombustion in self.get_mutations():
				user_hasCombustion = True
				explode_damage = ewutils.slime_bylevel(self.slimelevel) / 5
				explode_district = ewdistrict.EwDistrict(district = self.poi, id_server = self.id_server)
				explode_poi_channel = ewcfg.id_to_poi.get(self.poi).channel

		if cause == ewcfg.cause_busted:
			self.busted = True
			self.poi = ewcfg.poi_id_thesewers
			#self.slimes = int(self.slimes * 0.9)
		else:
			self.busted = False  # reset busted state on normal death; potentially move this to ewspooky.revive
			self.slimes = 0
			self.slimelevel = 1
			self.clear_mutations()
			self.clear_allstatuses()
			self.totaldamage = 0
			self.bleed_storage = 0
			self.hunger = 0
			self.inebriation = 0
			self.bounty = 0
			self.time_lastdeath = time_now		
	
			# if self.life_state == ewcfg.life_state_shambler:
			# 	self.degradation += 1
			# else:
			# 	self.degradation += 5

			ewstats.increment_stat(user = self, metric = ewcfg.stat_lifetime_deaths)
			ewstats.change_stat(user = self, metric = ewcfg.stat_lifetime_slimeloss, n = self.slimes)

			if cause == ewcfg.cause_cliff:
				pass
			else:
				if self.life_state == ewcfg.life_state_juvenile: # If you were a Juvenile.
					item_fraction = 4
					food_fraction = 4
					cosmetic_fraction = 4

				else:  # If you were a Gangster.
					item_fraction = 2
					food_fraction = 2
					cosmetic_fraction = 2
					self.slimecoin = int(self.slimecoin) - (int(self.slimecoin) / 10)

				ewitem.item_dropsome(id_server = self.id_server, id_user = self.id_user, item_type_filter = ewcfg.it_item, fraction = item_fraction) # Drop a random fraction of your items on the ground.
				ewitem.item_dropsome(id_server = self.id_server, id_user = self.id_user, item_type_filter = ewcfg.it_food, fraction = food_fraction) # Drop a random fraction of your food on the ground.

				ewitem.item_dropsome(id_server = self.id_server, id_user = self.id_user, item_type_filter = ewcfg.it_cosmetic, fraction = cosmetic_fraction) # Drop a random fraction of your unadorned cosmetics on the ground.
				ewitem.item_dedorn_cosmetics(id_server = self.id_server, id_user = self.id_user) # Unadorn all of your adorned hats.
				self.freshness = 0

				ewitem.item_dropsome(id_server = self.id_server, id_user = self.id_user, item_type_filter = ewcfg.it_weapon, fraction = 1) # Drop random fraction of your unequipped weapons on the ground.
				ewutils.weaponskills_clear(id_server = self.id_server, id_user = self.id_user, weaponskill = ewcfg.weaponskill_max_onrevive)

			self.life_state = ewcfg.life_state_corpse
			self.poi_death = self.poi
			self.poi = ewcfg.poi_id_thesewers
			self.weapon = -1
			self.time_expirpvp = 0

		if cause == ewcfg.cause_killing_enemy:  # If your killer was an Enemy. Duh.
			ewstats.increment_stat(user = self, metric = ewcfg.stat_lifetime_pve_deaths)

		if cause == ewcfg.cause_leftserver:
			ewitem.item_dropall(id_server=self.id_server, id_user=self.id_user)

		self.sap = 0
		self.hardened_sap = 0
		self.attack = 0
		self.defense = 0
		self.speed = 0

		ewutils.moves_active[self.id_user] = 0
		ewutils.active_target_map[self.id_user] = ""
		ewutils.active_restrictions[self.id_user] = 0
		ewstats.clear_on_death(id_server = self.id_server, id_user = self.id_user)

		self.persist()

		if cause not in explosion_block_list: # Run explosion after location/stat reset, to prevent looping onto self
			if user_hasCombustion:
				explode_resp = "\n{} spontaneously combusts, horribly dying in a fiery explosion of slime and shrapnel!! Oh, the humanity!\n".format(server.get_member(self.id_user).display_name)
				ewutils.logMsg("")
				resp_cont.add_channel_response(explode_poi_channel, explode_resp)

				explosion = ewutils.explode(damage = explode_damage, district_data = explode_district)
				resp_cont.add_response_container(explosion)

		#ewitem.item_destroyall(id_server = self.id_server, id_user = self.id_user)

		ewutils.logMsg('server {}: {} was killed by {} - cause was {}'.format(self.id_server, self.id_user, self.id_killer, cause))

		return(resp_cont)
コード例 #3
0
ファイル: ew.py プロジェクト: seanialt/endless-war
	def die(self, cause = None):
		time_now = int(time.time())

		ewutils.end_trade(self.id_user)

		if cause == ewcfg.cause_busted:
			self.busted = True
			self.poi = ewcfg.poi_id_thesewers
			#self.slimes = int(self.slimes * 0.9)
		else:
			self.busted = False  # reset busted state on normal death; potentially move this to ewspooky.revive
			self.slimes = 0
			self.slimelevel = 1
			self.clear_mutations()
			self.clear_allstatuses()
			self.totaldamage = 0
			self.bleed_storage = 0
			self.hunger = 0
			self.inebriation = 0
			self.bounty = 0

			ewstats.increment_stat(user = self, metric = ewcfg.stat_lifetime_deaths)
			ewstats.change_stat(user = self, metric = ewcfg.stat_lifetime_slimeloss, n = self.slimes)


			if self.time_expirpvp >= time_now: # If you were Wanted.
				if cause != ewcfg.cause_cliff:
					ewitem.item_dropall(id_server = self.id_server, id_user = self.id_user)

				ewutils.weaponskills_clear(id_server = self.id_server, id_user = self.id_user, weaponskill = ewcfg.weaponskill_min_onrevive)
				self.slimecoin = 0
				self.weaponmarried = False

			if cause == ewcfg.cause_cliff:
				pass
			else:
				if self.life_state == ewcfg.life_state_juvenile: # If you were a Juvenile.
					item_fraction = 4
					food_fraction = 4
					cosmetic_fraction = 4

				else:  # If you were mired in normal Gang Violence, meaning if you were a Rowdy and your killer was a Killer, or vice versa.
					item_fraction = 2
					food_fraction = 2
					cosmetic_fraction = 2
					self.slimecoin = int(self.slimecoin) - (int(self.slimecoin) / 10)

				ewitem.item_dropsome(id_server = self.id_server, id_user = self.id_user, item_type_filter = ewcfg.it_item, fraction = item_fraction) # Drop a random fraction of your items on the ground.
				ewitem.item_dropsome(id_server = self.id_server, id_user = self.id_user, item_type_filter = ewcfg.it_food, fraction = food_fraction) # Drop a random fraction of your food on the ground.

				ewitem.item_dropsome(id_server = self.id_server, id_user = self.id_user, item_type_filter = ewcfg.it_cosmetic, fraction = cosmetic_fraction) # Drop a random fraction of your unadorned cosmetics on the ground.
				ewitem.item_dedorn_cosmetics(id_server = self.id_server, id_user = self.id_user) # Unadorn all of your adorned hats.

				ewitem.item_dropsome(id_server = self.id_server, id_user = self.id_user, item_type_filter = ewcfg.it_weapon, fraction = 1) # Drop random fraction of your unequipped weapons on the ground.
				ewutils.weaponskills_clear(id_server = self.id_server, id_user = self.id_user, weaponskill = ewcfg.weaponskill_max_onrevive)

			self.life_state = ewcfg.life_state_corpse
			self.poi_death = self.poi
			self.poi = ewcfg.poi_id_thesewers
			self.weapon = -1
			self.time_expirpvp = 0

		if cause == ewcfg.cause_killing_enemy:  # If your killer was an Enemy. Duh.
			ewstats.increment_stat(user = self, metric = ewcfg.stat_lifetime_pve_deaths)

		if cause == ewcfg.cause_leftserver:
			ewitem.item_dropall(id_server=self.id_server, id_user=self.id_user)

		self.sap = 0
		self.hardened_sap = 0
		ewutils.moves_active[self.id_user] = 0
		ewstats.clear_on_death(id_server = self.id_server, id_user = self.id_user)

		#ewitem.item_destroyall(id_server = self.id_server, id_user = self.id_user)

		ewutils.logMsg('server {}: {} was killed by {} - cause was {}'.format(self.id_server, self.id_user, self.id_killer, cause))