Ejemplo n.º 1
0
def battle(self, attacker, aa, ad, bd0, tloc, da, dd, bd1):
	loc = LOCATION((attacker >> 8) & 0xff)
	seq = (attacker >> 16) & 0xff
	c2 = attacker & 0xff
	card = self.get_card(c2, loc, seq)
	tc = tloc & 0xff
	tl = LOCATION((tloc >> 8) & 0xff)
	tseq = (tloc >> 16) & 0xff
	if tloc:
		target = self.get_card(tc, tl, tseq)
	else:
		target = None
	for pl in self.players + self.watchers:
		if card.type & TYPE.LINK:
			attacker_points = "%d"%aa
		else:
			attacker_points = "%d/%d"%(aa, ad)

		if target:
			if target.type & TYPE.LINK:
				defender_points = "%d"%da
			else:
				defender_points = "%d/%d"%(da, dd)

		if target:
			pl.notify(pl._("%s (%s) attacks %s (%s)") % (card.get_name(pl), attacker_points, target.get_name(pl), defender_points))
		else:
			pl.notify(pl._("%s (%s) attacks") % (card.get_name(pl), attacker_points))
Ejemplo n.º 2
0
def msg_confirm_decktop(self, data):
    cards = []
    data = io.BytesIO(data[1:])
    player = self.read_u8(data)
    count = self.read_u8(data)
    for i in range(count):
        code = self.read_u32(data)
        if code & 0x80000000:
            code = code ^ 0x80000000  # don't know what this actually does
        card = Card(code)
        card.controller = self.read_u8(data)
        card.location = LOCATION(self.read_u8(data))
        card.sequence = self.read_u8(data)
        cards.append(card)

    self.cm.call_callbacks('confirm_decktop', player, cards)
    return data.read()
Ejemplo n.º 3
0
def msg_counters(self, data):
    data = io.BytesIO(data[0:])

    msg = self.read_u8(data)

    ctype = self.read_u16(data)

    pl = self.read_u8(data)

    loc = LOCATION(self.read_u8(data))

    seq = self.read_u8(data)

    count = self.read_u16(data)

    card = self.get_card(pl, loc, seq)

    self.cm.call_callbacks('counters', card, ctype, count, msg == 101)

    return data.read()