Beispiel #1
0
func getPlayerKind() *playerKind {
	if kind == nil {
		kind = &playerKind{gameObjectsBase.NewKind()}
		kind.SetRace(consts.PLAYER_RACE)
		kind.Flags = append(kind.Flags, gameObjectsFlags.GetFlag("CAN_MOVE"))
		kind.Flags = append(kind.Flags, gameObjectsFlags.GetFlag("CAN_BLOW"))
	}
	return kind
}
Beispiel #2
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}
}
Beispiel #3
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
}