diff --git a/IRCUFC/fight.py b/IRCUFC/fight.py index e7d44cd..be9d198 100644 --- a/IRCUFC/fight.py +++ b/IRCUFC/fight.py @@ -117,9 +117,9 @@ class Fight(object): else: for f in self.fighters: if f.nick == nick: - self.IRC.privmsg(nick, "[{}] Status for {} -> Current health: {} | Current stance: {} | Next action: {}".format(self.IRC.mirc.color("*", self.IRC.mirc.colors.GREEN), f.nick, int(f.hp), f.stance, f.nextAction)) + self.IRC.privmsg(nick, "[{}] Status for {} -> Current health: {} | Current stance: {} {} | Next action: {}".format(self.IRC.mirc.color("*", self.IRC.mirc.colors.GREEN), f.nick, int(f.hp), f.stance, f.groundPos if f.groundPos else "", f.nextAction if f.nextAction else "")) else: - self.IRC.privmsg(nick, "[{}] Status for {} -> Current health: {} | Current stance: {}".format(self.IRC.mirc.color("*", self.IRC.mirc.colors.GREEN), f.nick, int(f.hp), f.stance)) + self.IRC.privmsg(nick, "[{}] Status for {} -> Current health: {} | Current stance: {} {}".format(self.IRC.mirc.color("*", self.IRC.mirc.colors.GREEN), f.nick, int(f.hp), f.stance, f.groundPos if f.groundPos else "")) def fightOver(self): @@ -174,19 +174,22 @@ class Fight(object): def get_next_move_data(self, f, e): - dmg = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['dmgidx'] - mindmg = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['mindmg'] - blockidx = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['blockidx'] - fallchance = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['fallchance'] \ - if 'fallchance' in self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance] \ - else 0 - standchance = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['standchance'] \ - if 'standchance' in self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance] \ - else 0 + if f.stance == e.stance == 'ground': + dmg = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance][e.groundPos]['dmgidx'] + mindmg = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance][e.groundPos]['mindmg'] + blockidx = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance][e.groundPos]['blockidx'] + fallchance = 0 + texts = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance][e.groundPos]['text'] + else: + dmg = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['dmgidx'] + mindmg = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['mindmg'] + blockidx = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['blockidx'] + fallchance = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['fallchance'] \ + if 'fallchance' in self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance] \ + else 0 + texts = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['text'] - texts = self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance]['text'] - - return dmg, mindmg, blockidx, fallchance, standchance, texts + return dmg, mindmg, blockidx, fallchance, texts def attack(self): roll1 = roll2 = 0 @@ -221,10 +224,19 @@ class Fight(object): attacker.advantage = True defender.advantage = False + if attacker.stance == defender.stance == 'ground': + if attacker.groundPos == 'below': + attacker.groundPos = 'above' + defender.groundPos = 'below' + self.shout("{} Manage to get above {}!".format( \ + self.IRC.mirc.color(attacker.nick, attacker.colour), \ + self.IRC.mirc.color(defender.nick, defender.colour) \ + )) + if attacker.nextAction[0] == 'standup': standchance = self.config['moves'][attacker.stance]['standup'][defender.stance]['chance'] else: - dmg, mindmg, blockidx, fallchance, standchance, texts = self.get_next_move_data(attacker, defender) + dmg, mindmg, blockidx, fallchance, texts = self.get_next_move_data(attacker, defender) txt = self.prettyTxt(attacker, defender, texts) self.shout("{}".format(txt)) @@ -250,6 +262,10 @@ class Fight(object): if (random.random() * 100) < fallchance: # defender falls down? defender.stance = 'ground' + if attacker.stance == 'ground': + defender.groundPos = 'above' + else: + defender.groundPos = 'below' falltxt = self.prettyTxt(attacker, defender, self.config['info']['stand2ground']) self.shout("{}".format(falltxt)) @@ -266,8 +282,11 @@ class Fight(object): if attacker.nextAction[0] == 'standup': # attacker gets up? - if (random.random() * 100) < standchance: # DO you get up? + if (random.random() * 100) < standchance: attacker.stance = 'stand' + attacker.groundPos = None + if defender.stance == 'ground' and defender.groundPos == 'above': + defender.groundPos = 'below' standtxt = self.prettyTxt(attacker, defender, self.config['info']['ground2stand']) self.shout("{}".format(standtxt)) diff --git a/IRCUFC/fighter.py b/IRCUFC/fighter.py index 701252f..0c5ba1c 100644 --- a/IRCUFC/fighter.py +++ b/IRCUFC/fighter.py @@ -11,6 +11,7 @@ class Fighter(object): self.hp = 100 self.stance = 'stand' + self.groundPos = None self.nextAction = None diff --git a/assets/config.json b/assets/config.json index 8b42043..36baa30 100644 --- a/assets/config.json +++ b/assets/config.json @@ -128,7 +128,12 @@ "chance": 20 }, "ground": { - "chance": 70 + "above": { + "chance": 10 + }, + "below": { + "chance": 85 + } } }, "kick": { @@ -143,12 +148,22 @@ ] }, "ground": { - "dmgidx": 40, - "mindmg": 23, - "blockidx": 42, - "text": [ - "%attacker% hit %defender% with huge kneel kicks to the head!" - ] + "above": { + "dmgidx": 20, + "mindmg": 11, + "blockidx": 66, + "text": [ + "%attacker% hit %defender% with kneel kicks to the head from below" + ] + }, + "below": { + "dmgidx": 40, + "mindmg": 23, + "blockidx": 42, + "text": [ + "%attacker% hit %defender% with huge kneel kicks to the head!" + ] + } } }, "middle": { @@ -162,12 +177,22 @@ ] }, "ground": { - "dmgidx": 25, - "mindmg": 17, - "blockidx": 48, - "text": [ - "%attacker% hit %defender% with kneel kicks to the body" - ] + "above": { + "dmgidx": 13, + "mindmg": 9, + "blockidx": 70, + "text": [ + "%attacker% hit %defender% with kneel kicks to the body for below" + ] + }, + "below": { + "dmgidx": 25, + "mindmg": 17, + "blockidx": 48, + "text": [ + "%attacker% hit %defender% with kneel kicks to the body" + ] + } } }, "low": { @@ -181,12 +206,22 @@ ] }, "ground": { - "dmgidx": 15, - "mindmg": 2, - "blockidx": 40, - "text": [ - "%attacker% hit %defender% with kneel kicks to the legs" - ] + "above": { + "dmgidx": 7, + "mindmg": 2, + "blockidx": 65, + "text": [ + "%attacker% hit %defender% with kneel kicks to the legs from below" + ] + }, + "below": { + "dmgidx": 15, + "mindmg": 2, + "blockidx": 40, + "text": [ + "%attacker% hit %defender% with kneel kicks to the legs" + ] + } } } }, diff --git a/assets/palmares.json b/assets/palmares.json new file mode 100644 index 0000000..7bb5625 --- /dev/null +++ b/assets/palmares.json @@ -0,0 +1 @@ +{"wr34k": {"wins": 1, "looses": 0}, "wreek": {"wins": 0, "looses": 1}} \ No newline at end of file diff --git a/assets/palmares.json.bkp b/assets/palmares.json.bkp new file mode 100644 index 0000000..e69de29