Beispiel #1
0
func (bl *BlowList) addBlow(blow fightBase.Blower) {
	var isRange bool = blow.IsRange()
	bl.blows = append(bl.blows, blow)
	var b *[]int
	if isRange {
		b = &(bl.meleeBlows)
	} else {
		b = &(bl.rangeBlows)
	}
	*b = append(*b, len(bl.blows)-1)
}
func (obj *ActiveObject) GetHit(blow fightBase.Blower, attacker Activer) consts.JsonType {
	var res = consts.JsonType{"event": "attack"}
	res["description"] = consts.JsonType{
		"blowType":    blow.GetBlowType(),
		"dealtDamage": blow.GetDamage(),
	}
	if !obj.Killed() {
		obj.Characteristics[consts.CHARACTERISTIC_HP] -= blow.GetDamage()
		if obj.Killed() {
			res["killed"] = true
			if obj != attacker {
				attacker.IncExp(attacker, 500) //need Dice
			}
		}
	}
	return res
}