This commit is contained in:
aozhiwei 2022-09-08 12:02:01 +08:00
parent d0d2c1470e
commit 69a22fb1ee
6 changed files with 59 additions and 5 deletions

View File

@ -57,11 +57,15 @@ public:
void Init()
{
#if 1
DefaultInit();
#else
if (hero_dto) {
DtoInit();
} else {
DefaultInit();
}
#endif
}
private:
@ -159,11 +163,15 @@ public:
void Init()
{
#if 1
DefaultInit();
#else
if (weapon_dto) {
DtoInit();
} else {
DefaultInit();
}
#endif
}
private:

View File

@ -1655,6 +1655,10 @@ void Creature::ResetAction()
action_item_id = 0;
action_target_id = 0;
need_sync_active_player = true;
if (reload_delay_timer_) {
room->xtimer.DeleteTimer(reload_delay_timer_);
reload_delay_timer_ = nullptr;
}
}
bool Creature::IsProperTarget(Creature* target, bool no_teammate)
@ -1770,7 +1774,8 @@ void Creature::Shot(a8::Vec2& target_dir, bool& shot_ok, float fly_distance)
if (GetCurrWeapon()->weapon_idx != 0 &&
GetCurrWeapon()->ammo <= 0) {
AutoLoadingBullet();
CheckLoadingBullet();
//AutoLoadingBullet();
return;
}
@ -2954,9 +2959,15 @@ void Creature::AutoSwitchWeapon()
void Creature::CheckLoadingBullet()
{
if (GetCurrWeapon()->weapon_idx != 0 &&
GetCurrWeapon()->ammo <= 0) {
GetCurrWeapon()->ammo <= 0 &&
!reload_delay_timer_) {
#ifdef DEBUG
if (IsPlayer()) {
a8::XPrintf("CheckLoadingBullet1\n", {});
}
#endif
if (GetCurrWeapon()->meta->i->reload_delay_time() > 0) {
room->xtimer.AddDeadLineTimerAndAttach
reload_delay_timer_ = room->xtimer.AddDeadLineTimerAndAttach
(
GetCurrWeapon()->meta->i->reload_delay_time() / FRAME_RATE_MS,
a8::XParams()
@ -2967,12 +2978,28 @@ void Creature::CheckLoadingBullet()
Creature* c = (Creature*)param.sender.GetUserData();
int weapon_id = param.param1;
if (c->GetCurrWeapon()->weapon_id == weapon_id) {
#ifdef DEBUG
if (c->IsPlayer()) {
a8::XPrintf("CheckLoadingBullet3\n", {});
}
#endif
c->AutoLoadingBullet();
}
},
&xtimer_attacher.timer_list_
);
&xtimer_attacher.timer_list_,
[] (const a8::XParams& param)
{
Creature* c = (Creature*)param.sender.GetUserData();
if (c->reload_delay_timer_) {
c->reload_delay_timer_ = nullptr;
}
});
} else {
#ifdef DEBUG
if (IsPlayer()) {
a8::XPrintf("CheckLoadingBullet2\n", {});
}
#endif
AutoLoadingBullet();
}
}

View File

@ -324,6 +324,7 @@ private:
std::list<std::tuple<int, Hero*>> slave_heros_;
std::list<std::tuple<int, RoomObstacle*>> slave_things_;
xtimer_list* auto_switch_weapon_timer_ = nullptr;
xtimer_list* reload_delay_timer_ = nullptr;
int follow_times_ = 0;
int disable_move_dir_times_ = 0;

View File

@ -1044,10 +1044,12 @@ namespace MetaData
}
}
{
#if 0
number_meta = MetaMgr::Instance()->GetSkillNumber(i->skill_id());
if (!number_meta) {
abort();
}
#endif
}
}

View File

@ -287,6 +287,7 @@ namespace MetaData
void Init();
void Init2();
int magic_type = 0;
float value_up = 0.0f;
std::set<int> buff_list;
std::map<int, std::set<MetaData::Buff*>> trigger_type_buffs;

View File

@ -16,6 +16,21 @@ enum SkillMinorType
SMT_BLINK = 1,
};
enum MagicType_e
{
MAGIC_NONE = 0,
MAGIC_AXXF = 1,
MAGIC_SJYDHX = 2,
MAGIC_HLYZ = 3,
MAGIC_YMCZ = 4,
MAGIC_LDFY = 5,
MAGIC_HJHX = 6,
MAGIC_FG = 7,
MAGIC_WLFB = 8,
MAGIC_YLZ = 9,
MAGIC_YS = 10,
};
struct xtimer_list;
class Creature;
class Skill