Ground game!

This commit is contained in:
wr34k 2018-07-03 18:41:54 +02:00
parent 4993f405b4
commit 69c7f0de1f
5 changed files with 91 additions and 35 deletions

View File

@ -117,9 +117,9 @@ class Fight(object):
else: else:
for f in self.fighters: for f in self.fighters:
if f.nick == nick: 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: 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): def fightOver(self):
@ -174,19 +174,22 @@ class Fight(object):
def get_next_move_data(self, f, e): def get_next_move_data(self, f, e):
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'] 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'] 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'] 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'] \ 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] \ if 'fallchance' in self.config['moves'][f.stance][f.nextAction[0]][f.nextAction[1]][e.stance] \
else 0 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
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): def attack(self):
roll1 = roll2 = 0 roll1 = roll2 = 0
@ -221,10 +224,19 @@ class Fight(object):
attacker.advantage = True attacker.advantage = True
defender.advantage = False 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': if attacker.nextAction[0] == 'standup':
standchance = self.config['moves'][attacker.stance]['standup'][defender.stance]['chance'] standchance = self.config['moves'][attacker.stance]['standup'][defender.stance]['chance']
else: 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) txt = self.prettyTxt(attacker, defender, texts)
self.shout("{}".format(txt)) self.shout("{}".format(txt))
@ -250,6 +262,10 @@ class Fight(object):
if (random.random() * 100) < fallchance: # defender falls down? if (random.random() * 100) < fallchance: # defender falls down?
defender.stance = 'ground' defender.stance = 'ground'
if attacker.stance == 'ground':
defender.groundPos = 'above'
else:
defender.groundPos = 'below'
falltxt = self.prettyTxt(attacker, defender, self.config['info']['stand2ground']) falltxt = self.prettyTxt(attacker, defender, self.config['info']['stand2ground'])
self.shout("{}".format(falltxt)) self.shout("{}".format(falltxt))
@ -266,8 +282,11 @@ class Fight(object):
if attacker.nextAction[0] == 'standup': # attacker gets up? 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.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']) standtxt = self.prettyTxt(attacker, defender, self.config['info']['ground2stand'])
self.shout("{}".format(standtxt)) self.shout("{}".format(standtxt))

View File

@ -11,6 +11,7 @@ class Fighter(object):
self.hp = 100 self.hp = 100
self.stance = 'stand' self.stance = 'stand'
self.groundPos = None
self.nextAction = None self.nextAction = None

View File

@ -128,7 +128,12 @@
"chance": 20 "chance": 20
}, },
"ground": { "ground": {
"chance": 70 "above": {
"chance": 10
},
"below": {
"chance": 85
}
} }
}, },
"kick": { "kick": {
@ -143,6 +148,15 @@
] ]
}, },
"ground": { "ground": {
"above": {
"dmgidx": 20,
"mindmg": 11,
"blockidx": 66,
"text": [
"%attacker% hit %defender% with kneel kicks to the head from below"
]
},
"below": {
"dmgidx": 40, "dmgidx": 40,
"mindmg": 23, "mindmg": 23,
"blockidx": 42, "blockidx": 42,
@ -150,6 +164,7 @@
"%attacker% hit %defender% with huge kneel kicks to the head!" "%attacker% hit %defender% with huge kneel kicks to the head!"
] ]
} }
}
}, },
"middle": { "middle": {
"stand": { "stand": {
@ -162,6 +177,15 @@
] ]
}, },
"ground": { "ground": {
"above": {
"dmgidx": 13,
"mindmg": 9,
"blockidx": 70,
"text": [
"%attacker% hit %defender% with kneel kicks to the body for below"
]
},
"below": {
"dmgidx": 25, "dmgidx": 25,
"mindmg": 17, "mindmg": 17,
"blockidx": 48, "blockidx": 48,
@ -169,6 +193,7 @@
"%attacker% hit %defender% with kneel kicks to the body" "%attacker% hit %defender% with kneel kicks to the body"
] ]
} }
}
}, },
"low": { "low": {
"stand": { "stand": {
@ -181,6 +206,15 @@
] ]
}, },
"ground": { "ground": {
"above": {
"dmgidx": 7,
"mindmg": 2,
"blockidx": 65,
"text": [
"%attacker% hit %defender% with kneel kicks to the legs from below"
]
},
"below": {
"dmgidx": 15, "dmgidx": 15,
"mindmg": 2, "mindmg": 2,
"blockidx": 40, "blockidx": 40,
@ -189,6 +223,7 @@
] ]
} }
} }
}
}, },
"block": { "block": {
"high": { "high": {

1
assets/palmares.json Normal file
View File

@ -0,0 +1 @@
{"wr34k": {"wins": 1, "looses": 0}, "wreek": {"wins": 0, "looses": 1}}

0
assets/palmares.json.bkp Normal file
View File