Пример #1
0
func NewMob(kind *MobKind, x, y float64, depth int64) *Mob {
	m := Mob{gameObjectsBase.NewActiveObject(-1, x, y, kind), 0}
	m.SetCharacteristic(consts.CHARACTERISTIC_HP, kind.GenHP())
	m.chooseDir()
	m.createDrop(int64(depth))
	return &m
}
Пример #2
0
func NewPlayer(id, dbId int64, class int, login, sid string, x, y float64) *Player {
	slots := make(map[int]*slot)
	for slotType, itemType := range consts.SlotItemMapping {
		slots[slotType] = newSlot(itemType)
	}
	p := &Player{gameObjectsBase.NewActiveObject(id, x, y, getPlayerKind()),
		login, sid, dbId, class, slots, wpns.GetWeapon(consts.FIST_WEAP), nil, nil}
	p.fist = gameObjectsBase.NewFistItem(p)
	return p
}
Пример #3
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}
}