Ejemplo n.º 1
0
func NewTestMob(x, y float64, race int, damage string, flags []interface{}) *Mob {
	// "25d2", "CLAW|HURT|1d1"
	kind := MobKind{gameObjectsBase.NewKind(), "", 0, dice.CreateDice(consts.DEFAULT_DICE), "", blowList.NewBlowList()}
	kind.blowList.AddBlowMethods(fmt.Sprintf("HIT|HURT|%s", damage))
	// kind := gameObjectsBase.NewKind()
	kind.SetRace(race)
	for _, flag := range flags {
		kind.AddFlag(gameObjectsFlags.GetFlag(flag.(string)))
	}
	return &Mob{gameObjectsBase.NewActiveObject(-1, x, y, &kind), 5}
}
Ejemplo n.º 2
0
func CreateMobKind(name string, base_hp int, hp_inc, description, blowMethods, flagsStr string) *MobKind {
	added := make(map[string]bool)
	kind := MobKind{gameObjectsBase.NewKind(), name, base_hp, dice.CreateDice(hp_inc), description, blowList.NewBlowList()}
	kind.blowList.AddBlowMethods(blowMethods)
	for _, flagName := range strings.Split(flagsStr, "|") {
		if race, isExist := gameObjectsFlags.GetRaceFlag(flagName); isExist {
			kind.SetRace(race)
		} else {
			flag := gameObjectsFlags.GetFlag(flagName)
			added[flagName] = true
			if flag != nil {
				kind.Flags = append(kind.Flags, flag)
			}
		}
	}
	if !added["NEVER_MOVE"] {
		kind.AddFlag(gameObjectsFlags.GetFlag("CAN_MOVE"))
	}
	if !added["NEVER_BLOW"] {
		kind.AddFlag(gameObjectsFlags.GetFlag("CAN_BLOW"))
	}
	return &kind
}
Ejemplo n.º 3
0
func CreateDmgDescription(damage string) DmgDescription {
	return DmgDescription{dice.CreateDice(damage)}
}