This commit is contained in:
aozhiwei 2024-09-11 16:41:03 +08:00
parent 718886e247
commit bc9aab25c6
3 changed files with 8 additions and 0 deletions

View File

@ -2504,6 +2504,7 @@ void Creature::OnBattleStart(Room* room)
TryAddBuffAndSetTime(this, kInvincibleBuffId, FRAME_RATE_MS * 2); TryAddBuffAndSetTime(this, kInvincibleBuffId, FRAME_RATE_MS * 2);
} }
battle_start_time_ = f8::App::Instance()->GetNowTime(); battle_start_time_ = f8::App::Instance()->GetNowTime();
GetTrigger()->OnBattleStart();
} }
bool Creature::CanFollow(Creature* follower) bool Creature::CanFollow(Creature* follower)

View File

@ -738,3 +738,8 @@ void Trigger::BulletDmgEnd(Creature* target)
{ {
DispatchEvent(kBulletDmgEndEvent, {target}); DispatchEvent(kBulletDmgEndEvent, {target});
} }
void Trigger::OnBattleStart()
{
DispatchEvent(kBattleStartEvent, {});
}

View File

@ -39,6 +39,7 @@ enum EventId_e
kBulletDmgStartEvent, kBulletDmgStartEvent,
kBulletDmgEndEvent, kBulletDmgEndEvent,
kCrazeModeEvent, kCrazeModeEvent,
kBattleStartEvent
}; };
class Weapon; class Weapon;
@ -94,6 +95,7 @@ public:
void BeAttack(int attacker_id); void BeAttack(int attacker_id);
void BulletDmgStart(Creature* target); void BulletDmgStart(Creature* target);
void BulletDmgEnd(Creature* target); void BulletDmgEnd(Creature* target);
void OnBattleStart();
std::weak_ptr<EventHandler> AddListener(int event_id, a8::CommonCbProc cb); std::weak_ptr<EventHandler> AddListener(int event_id, a8::CommonCbProc cb);
void RemoveEventHandler(std::weak_ptr<EventHandler> handler_ptr); void RemoveEventHandler(std::weak_ptr<EventHandler> handler_ptr);