feat: 实现战斗奖励规则302-316
This commit is contained in:
@@ -1,6 +1,20 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule302 n回合后击败获取奖励
|
||||
type Rule302 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule302) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
if t.Round >= uint32(r.args[0]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule303 使用xx技能击败(攻击致死)获取奖励
|
||||
// args[0] = 技能ID
|
||||
type Rule303 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule303) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
if f.GetAttackValue(false).SkillID == uint32(r.args[0]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule304 使用xx技能后(属性技能)击败获取奖励
|
||||
// args[0] = 技能ID
|
||||
type Rule304 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule304) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
if f.GetAttackValue(false).SkillID == uint32(r.args[0]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule305 满血击败后获取奖励
|
||||
type Rule305 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule305) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
attack := f.GetAttackValue(false)
|
||||
if attack.RemainHp >= int32(attack.MaxHp) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule306 对方在xx异常状态下击败后获取奖励
|
||||
// args[0] = 异常状态类型(对应 EnumPetStatus 枚举值)
|
||||
type Rule306 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule306) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
statusIdx := r.args[0]
|
||||
if statusIdx >= 0 && statusIdx < 20 {
|
||||
oppAttack := f.GetAttackValue(true)
|
||||
// Status[i] != 255(NULL) 表示该状态存在
|
||||
if oppAttack.Status[statusIdx] != 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule307 满足特定属性强化下击败后获取奖励
|
||||
// args[0] = 属性索引(0攻击,1防御,2特攻,3特防,4速度,5命中)
|
||||
// args[1] = 最低属性等级(范围 -6~+6)
|
||||
type Rule307 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule307) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
propIdx := r.args[0]
|
||||
if propIdx >= 0 && propIdx < 6 {
|
||||
selfAttack := f.GetAttackValue(false)
|
||||
if selfAttack.Prop[propIdx] >= int8(r.args[1]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule308 战斗中超过n伤害获取奖励
|
||||
// args[0] = 最低伤害阈值(单次攻击)
|
||||
type Rule308 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule308) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
if f.GetAttackValue(false).LostHp >= uint32(r.args[0]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule309 战斗持续n回合后获取奖励
|
||||
// args[0] = 回合数
|
||||
type Rule309 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule309) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
if t.Round >= uint32(r.args[0]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule310 不使用xx药剂击败获取奖励
|
||||
// args[0] = 药剂道具ID
|
||||
// 注:当前接口无法追溯战斗中道具使用记录,该规则依赖战斗外的限制机制(如战斗配置禁用道具)
|
||||
// Exec 只做获胜判断,药剂限制应在战斗创建阶段强制执行
|
||||
type Rule310 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule310) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
// 药剂限制应在战斗配置阶段强制执行,此处只判断是否获胜
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule311 偶数回合击败后获取奖励
|
||||
type Rule311 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule311) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
if t.Round%2 == 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule312 奇数回合击败后获取奖励
|
||||
type Rule312 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule312) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
if t.Round%2 != 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule313 特定回合击败后获取奖励
|
||||
// args[0] = 指定回合数
|
||||
type Rule313 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule313) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
if t.Round == uint32(r.args[0]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule314 自身处于xx状态击败后获取奖励
|
||||
// args[0] = 状态类型(对应 EnumPetStatus 枚举值)
|
||||
type Rule314 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule314) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
statusIdx := r.args[0]
|
||||
if statusIdx >= 0 && statusIdx < 20 {
|
||||
selfAttack := f.GetAttackValue(false)
|
||||
// Status[i] != 255(NULL) 表示该状态存在
|
||||
if selfAttack.Status[statusIdx] != 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule315 自身不大于1/n血量击败
|
||||
// args[0] = 分母n,血量 <= MaxHp/n 时满足条件
|
||||
type Rule315 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule315) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
n := int32(r.args[0])
|
||||
if n > 0 {
|
||||
attack := f.GetAttackValue(false)
|
||||
maxHp := int32(attack.MaxHp)
|
||||
if maxHp > 0 && attack.RemainHp*n <= maxHp {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -1,6 +1,28 @@
|
||||
package rule
|
||||
|
||||
import (
|
||||
"blazing/logic/service/common"
|
||||
"blazing/modules/player/model"
|
||||
)
|
||||
|
||||
// Rule316 在自身所有技能都进入PP耗尽状态的情况下获胜获取精灵
|
||||
type Rule316 struct {
|
||||
RuleBase
|
||||
}
|
||||
|
||||
func (r *Rule316) Exec(f common.FightI, t *model.FightOverInfo) bool {
|
||||
if t.WinnerId == f.Ownerid() { //获胜
|
||||
attack := f.GetAttackValue(false)
|
||||
allPPEmpty := true
|
||||
for _, skill := range attack.SkillList {
|
||||
if skill.PP > 0 {
|
||||
allPPEmpty = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if allPPEmpty && len(attack.SkillList) > 0 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user