def take(self): self.battle = Battle(self.map, player=context.PLAYER, groups=self.groups, allies=self.allies, death=self.death, silent=self.silent) self.battle.start() context.battles[self.battle.id] = self.battle self.battle.reset_delta() self.battle.status_work(BattlePhase.Start) self.battle.deal() alivelist = [] for alive in self.battle.alive: if alive.hp == 0: alivelist.append(alive) for alive in alivelist: BattleQuitAction(subject=alive, battle=self.battle).do() tmp_teams = set() for g in self.groups: for p in g: if p.team.id in tmp_teams: continue p.team.process = context.timestamp + 1 tmp_teams.add(p.team.id) self.snapshot = self.battle.snapshot(False) if not self.battle.silent: MSG(style=MSG.BattleStart, action=self) context.timeflow(1) return self.battle
def take(self): s_id = self.subject.team.scenario.tpl_id terran = self.subject.team.scenario.grid(self.position).terran.tpl_id if s_id not in context.explorations: context.explorations[s_id] = {} s_exp = context.explorations[s_id] found = False for dis in context.discoveries.get(s_id, []) + context.discoveries.get( "ALL", []): dis_id = dis["id"] if dis_id not in s_exp: s_exp[dis_id] = {} if self.position not in s_exp[dis_id]: if "terrans" in dis and terran not in dis["terrans"]: continue if "locations" in dis and self.position not in dis["locations"]: continue if "tools" in dis and (self.tool is None or len(self.tool.tags & dis["tools"]) == 0): continue if "rate" in dis: rate = dis["rate"] else: rate = 1 if not ratio.if_rate(rate): continue if "quantity" in dis: if self.position not in s_exp[dis_id] or \ ("refresh" in dis and s_exp[dis_id][self.position]["timestamp"] + \ dis["refresh"] <= context.timestamp): s_exp[dis_id][self.position] = { "quantity": dis["quantity"], "timestamp": context.timestamp } if "range" in dis: quantity = min(random.randint(*dis["range"]), s_exp[dis_id][self.position]["quantity"]) else: quantity = min(1, s_exp[dis_id][self.position]["quantity"]) if quantity == 0: continue s_exp[dis_id][self.position]["quantity"] -= quantity found = True item = Item.one(dis["item"]) self.subject.add_item(item, quantity=quantity) MSG(style=MSG.PersonItemAcquire, action=self) if not found: MSG(style=MSG.PersonItemAcquire, action=self) context.timeflow(1)
def take(self): self.battle.append_group(group=self.group, allies=self.ally) self.battle.death = self.death tmp_teams = set() for p in self.group: if p.team.id in tmp_teams: continue p.team.process = context.timestamp + 1 tmp_teams.add(p.team.id) self.battle.silent = False self.snapshot = self.battle.snapshot(False) MSG(style=MSG.BattleStart, action=self) context.timeflow(1) return self.battle
def take(self): self.subject.targets.append((0, self.target)) if self.subject.scenario.tpl_id == "MAP_WORLD": self.subject.step = 30 else: self.subject.step = 1 self.subject.process = context.timestamp + self.subject.step context.teams[self.subject.id] = self.subject if self.subject.leader == context.PLAYER: if self.path is None: self.path = self.subject.scenario.connect_dynamic( self.subject.location, self.target, self.subject) self.subject.reset_path(self.path) context.timeflow((len(self.path) - 1) * self.subject.step) else: #context.teams[self.subject.id] = self.subject self.subject.path = [self.subject.scenario.location(self.subject)]
def take(self): print(self.itemargs) self.item.work(self.subject, objects=[self.object], **self.itemargs) context.timeflow(1)
def take(self): products = self.recipe.work(subject=self.subject, persons=self.persons) context.timeflow(1) return products
def take(self): context.timeflow(self.duration) WorldProcessAction().do()
def take(self): context.timeflow(self.period)
def process_battle(self, team): if team.battle.id not in self.battles: self.battles.add(team.battle.id) if not team.battle.silent: context.timeflow(6) team.process += 6
def take(self): context.timeflow(self.timeflow) MSG(style=MSG.Show, wait=True)