示例#1
0
func (bl *BlowList) ChooseBlowMethod(bt int) fightBase.Blower {
	dice.Shake()
	blow := bl.blows[dice.Throw(len(bl.blows), 1)-1]
	for (bt == fightBase.BT_MELEE && blow.IsRange()) || (bt == fightBase.BT_RANGE && !blow.IsRange()) {
		blow = bl.blows[dice.Throw(len(bl.blows), 1)-1]
	}
	return blow
}
示例#2
0
func (m *Mob) think() {
	if m.Target != nil {
		m.goToTarget()
	} else {
		m.walkingCycle++
		if m.walkingCycle == consts.MOB_WALKING_CYCLE_DURATION {
			dice.Shake()
			m.walkingCycle = 0
			m.chooseDir()
		}
	}
}
示例#3
0
func (m *Mob) GetHit(blow fightBase.Blower, attacker gameObjectsBase.Activer) consts.JsonType {
	res := m.ActiveObject.GetHit(blow, attacker)
	if t, isExist := m.GetTarget(); isExist {
		if t.GetType() != consts.PLAYER_TYPE {
			if attacker.GetType() == consts.PLAYER_TYPE {
				m.SetTarget(attacker)
			} else {
				dice.Shake()
				ary := [2]gameObjectsBase.Activer{t, attacker}
				m.SetTarget(ary[dice.Throw(2, 1)-1])
			}
		}
	} else {
		m.SetTarget(attacker)
	}
	return res
}
示例#4
0
func (dd *DmgDescription) GetDamage() int {
	dice.Shake()
	return dice.Throw(dd.edge_amount, dd.throws_amount)
}