diff --git a/exported/aip_mini_doujiang/aip_mini_doujiang.scml b/exported/aip_mini_doujiang/aip_mini_doujiang.scml
index 50cc6880..3746535c 100644
--- a/exported/aip_mini_doujiang/aip_mini_doujiang.scml
+++ b/exported/aip_mini_doujiang/aip_mini_doujiang.scml
@@ -292,7 +292,7 @@
-
+
@@ -300,7 +300,7 @@
-
+
@@ -308,13 +308,13 @@
-
+
-
+
-
+
@@ -341,13 +341,13 @@
-
+
-
+
-
+
@@ -391,7 +391,7 @@
-
+
@@ -415,7 +415,7 @@
-
+
@@ -456,7 +456,7 @@
-
+
@@ -480,7 +480,7 @@
-
+
@@ -846,7 +846,7 @@
-
+
@@ -857,7 +857,7 @@
-
+
@@ -909,10 +909,10 @@
-
+
-
+
@@ -920,7 +920,7 @@
-
+
@@ -1043,11 +1043,11 @@
-
+
-
+
@@ -1057,7 +1057,7 @@
-
+
@@ -1069,92 +1069,92 @@
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
@@ -1521,7 +1521,7 @@
-
+
@@ -1532,7 +1532,7 @@
-
+
diff --git a/scripts/behaviours/aipThrowBall.lua b/scripts/behaviours/aipThrowBall.lua
index 1e62b17b..b69cfb7b 100644
--- a/scripts/behaviours/aipThrowBall.lua
+++ b/scripts/behaviours/aipThrowBall.lua
@@ -41,7 +41,6 @@ function ThrowBall:Visit()
else
local target_position = Point(self.target.Transform:GetWorldPosition())
self.inst.components.locomotor:GoToPoint(
- -- self.target.components.aipc_score_ball:PredictPoint(0.3),
target_position,
nil,
true
@@ -50,7 +49,7 @@ function ThrowBall:Visit()
local me = Point(self.inst.Transform:GetWorldPosition())
if self.target.components.aipc_score_ball:CanThrow() and distsq(target_position, me) < 1 then
self.inst:PushEvent("throw", {target = self.target})
- self.inst.components.timer:StartTimer("aip_mini_dou_dall_throw", 2)
+ self.inst.components.timer:StartTimer("aip_mini_dou_dall_throw", 2.5)
if self.inst.components.talker ~= nil then
self.inst.components.talker:Say(STRINGS.AIP_MINI_DOUJIANG_THROW_BALL)
diff --git a/scripts/components/aipc_score_ball.lua b/scripts/components/aipc_score_ball.lua
index 1c67354b..b85d992a 100644
--- a/scripts/components/aipc_score_ball.lua
+++ b/scripts/components/aipc_score_ball.lua
@@ -10,6 +10,7 @@ local ScoreBall = Class(function(self, inst)
self.walkTime = 0
self.downTimes = 0
self.startTimes = 0
+ self.throwTimes = 0
end)
function ScoreBall:BindVest(ball)
@@ -46,6 +47,15 @@ function ScoreBall:Launch(speed, ySpeed)
self.inst.components.health:SetInvincible(true)
end
+function ScoreBall:ResetThrowCount()
+ local miniDou = FindEntity(self.inst, 15, nil, { "aip_mini_doujiang" })
+ if miniDou ~= nil and miniDou.aipPlayEnd ~= nil and self.throwTimes ~= 0 then
+ miniDou.aipPlayEnd(miniDou, self.throwTimes)
+ end
+
+ self.throwTimes = 0
+end
+
function ScoreBall:Throw(tgtPos, speed, ySpeed) -- 朝着方向扔球
local srcPos = self.inst:GetPosition()
local angle = aipGetAngle(tgtPos, srcPos)
@@ -55,6 +65,8 @@ function ScoreBall:Throw(tgtPos, speed, ySpeed) -- 朝着方向扔球
self.startTimes = 0
self.downTimes = 0
+ self.throwTimes = self.throwTimes + 1
+
self:Launch(speed, ySpeed)
end
@@ -67,18 +79,6 @@ function ScoreBall:Kick(attacker, speed, ySpeed) -- 攻击球
self:Throw(tgtPos, speed, ySpeed)
end
-function ScoreBall:PredictPoint(second) -- 落球点预测
- local srcPos = self.inst:GetPosition()
- local rotation = self.inst.Transform:GetRotation()
- local radius = rotation / 180 * PI
- local tgtPos = Vector3(
- srcPos.x + math.cos(radius) * self.speed * second,
- 0,
- srcPos.z + math.sin(radius) * self.speed * second
- )
- return tgtPos
-end
-
-- 若光可以跟着球跑
function ScoreBall:CanFollow()
local x, y, z = self.ball.Transform:GetWorldPosition()
@@ -94,7 +94,7 @@ function ScoreBall:CanThrow()
local x, y, z = self.ball.Transform:GetWorldPosition()
return self:CanFollow() and (
(self.downTimes == 1 and y < 1.5) or -- 第一次下落至 1.5 高度
- (self.startTimes == 2 and y < 1.5) -- 第二次 1.5 高度内
+ (self.startTimes == 2 and y < 1) -- 第二次 1.5 高度内
)
end
@@ -128,9 +128,16 @@ function ScoreBall:OnUpdate(dt)
-- 如果还有一些速度,我们就弹起来
self.recordSpeed = self.recordSpeed / 2
self.yRecordSpeed = self.yRecordSpeed / 3 * 2
- aipTypePrint(self.yRecordSpeed)
- if self.recordSpeed > .5 and self.yRecordSpeed >= 1 then
+
+ if self.recordSpeed > .2 and self.yRecordSpeed >= 1 then
self:Launch(self.recordSpeed, self.yRecordSpeed)
+
+ -- 如果弹了两次就重置扔球时间
+ if self.downTimes >= 2 then
+ self:ResetThrowCount()
+ end
+ else
+ self:ResetThrowCount() -- 不弹起则重置扔球时间
end
end
end
diff --git a/scripts/prefabs/aip_mini_doujiang.lua b/scripts/prefabs/aip_mini_doujiang.lua
index 4f3d16dc..852852a2 100644
--- a/scripts/prefabs/aip_mini_doujiang.lua
+++ b/scripts/prefabs/aip_mini_doujiang.lua
@@ -1,3 +1,6 @@
+-- 开发模式
+local dev_mode = aipGetModConfig("dev_mode") == "enabled"
+
local brain = require "brains/aip_mini_dou_brain"
local assets = {
@@ -20,6 +23,8 @@ local LANG_MAP = {
REQUIRE_PLAY = "Throw it to me~",
BYE = "Bye~",
THROW_BALL = "I got it!",
+ THROW_BALL_FAIL = "T_T",
+ THROW_BALL_REWARD = "Nice play~",
},
chinese = {
NAME = "若光",
@@ -28,6 +33,8 @@ local LANG_MAP = {
REQUIRE_PLAY = "把球打给我吧~",
BYE = "要走了吗?",
THROW_BALL = "嗷呜!",
+ THROW_BALL_FAIL = "哼,接不住了",
+ THROW_BALL_REWARD = "和你玩的真开心,谢谢",
},
}
@@ -40,6 +47,8 @@ STRINGS.AIP_MINI_DOUJIANG_NEED_RECIPE = LANG.NEED_RECIPE
STRINGS.AIP_MINI_DOUJIANG_REQUIRE_PLAY = LANG.REQUIRE_PLAY
STRINGS.AIP_MINI_DOUJIANG_BYE = LANG.BYE
STRINGS.AIP_MINI_DOUJIANG_THROW_BALL = LANG.THROW_BALL
+STRINGS.AIP_MINI_DOUJIANG_THROW_BALL_FAIL = LANG.THROW_BALL_FAIL
+STRINGS.AIP_MINI_DOUJIANG_THROW_BALL_REWARD = LANG.THROW_BALL_REWARD
------------------------------- 方法 -------------------------------
-- 玩家靠近
@@ -94,6 +103,22 @@ local function aipThrowBallBack(inst, ball)
)
end
+-- 判断是否要给奖励
+local function aipPlayEnd(inst, throwTimes)
+ local rewardTimes = dev_mode and 4 or 15
+
+ if throwTimes < rewardTimes then
+ -- 得分太低
+ inst.components.talker:Say(STRINGS.AIP_MINI_DOUJIANG_THROW_BALL_FAIL)
+ inst:PushEvent("talk")
+ else
+ -- 奖励物品
+ inst.components.lootdropper:SpawnLootPrefab("aip_score_ball_blueprint")
+ inst.components.talker:Say(STRINGS.AIP_MINI_DOUJIANG_THROW_BALL_REWARD)
+ inst:PushEvent("talk")
+ end
+end
+
------------------------------- 实体 -------------------------------
local function fn()
local inst = CreateEntity()
@@ -163,6 +188,7 @@ local function fn()
end)
inst.aipThrowBallBack = aipThrowBallBack
+ inst.aipPlayEnd = aipPlayEnd
return inst
end
diff --git a/scripts/stategraphs/SGaip_mini_dou.lua b/scripts/stategraphs/SGaip_mini_dou.lua
index 0634fffa..e2a953e3 100644
--- a/scripts/stategraphs/SGaip_mini_dou.lua
+++ b/scripts/stategraphs/SGaip_mini_dou.lua
@@ -29,8 +29,8 @@ local states = {
inst.Physics:Stop()
end,
- timeline = {-- 30*360/1000
- TimeEvent(10.8*FRAMES, function(inst)
+ timeline = {-- 30*100/1000
+ TimeEvent(3*FRAMES, function(inst)
inst.aipThrowBallBack(inst, inst.sg.statemem.target)
end),
},