1
This commit is contained in:
parent
3b4108804f
commit
4f64659756
@ -2139,20 +2139,44 @@ void Human::ProcReloadAction()
|
|||||||
|
|
||||||
void Human::ProcUseItemAction()
|
void Human::ProcUseItemAction()
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
const mt::Equip* item_meta = mt::Equip::GetById(action_item_id);
|
||||||
|
#else
|
||||||
const mt::Equip* item_meta = mt::Equip::GetByIdBySlotId(action_item_id);
|
const mt::Equip* item_meta = mt::Equip::GetByIdBySlotId(action_item_id);
|
||||||
|
#endif
|
||||||
if (!item_meta) {
|
if (!item_meta) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GetInventory(item_meta->_inventory_slot()) <= 0) {
|
if (GetInventory(item_meta->_inventory_slot()) <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (action_item_id) {
|
switch (item_meta->_inventory_slot()) {
|
||||||
case IS_HEALTHKIT:
|
case IS_HEALTHKIT:
|
||||||
{
|
{
|
||||||
+stats.use_medicine_times;
|
+stats.use_medicine_times;
|
||||||
AddHp(item_meta->heal() * (1 + GetAbility()->GetAttrRate(kHAT_DrugEfficacy)));
|
switch (std::get<0>(item_meta->_heal)) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
#if 1
|
||||||
|
AddHp(std::get<1>(item_meta->_heal));
|
||||||
|
#else
|
||||||
|
AddHp(std::<>item_meta->heal() * (1 + GetAbility()->GetAttrRate(kHAT_DrugEfficacy)));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
AddHp(std::get<1>(item_meta->_heal) * GetMaxHP());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
DecInventory(item_meta->_inventory_slot(), 1);
|
DecInventory(item_meta->_inventory_slot(), 1);
|
||||||
GetTrigger()->UseItemAction(action_item_id);
|
GetTrigger()->UseItemAction(item_meta->_inventory_slot());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IS_PAIN_KILLER:
|
case IS_PAIN_KILLER:
|
||||||
@ -2161,7 +2185,7 @@ void Human::ProcUseItemAction()
|
|||||||
if (!pain_killer_timer.expired()) {
|
if (!pain_killer_timer.expired()) {
|
||||||
int passed_time = (room->GetFrameNo() - pain_killer_frameno) * FRAME_RATE_MS;
|
int passed_time = (room->GetFrameNo() - pain_killer_frameno) * FRAME_RATE_MS;
|
||||||
int left_time = std::max(0, pain_killer_lastingtime * 1000 - passed_time);
|
int left_time = std::max(0, pain_killer_lastingtime * 1000 - passed_time);
|
||||||
int anodyne_max_time = mt::Param::GetIntParam("anodyne_max_time");
|
int anodyne_max_time = item_meta->time();
|
||||||
left_time = std::min(left_time, anodyne_max_time * 1000);
|
left_time = std::min(left_time, anodyne_max_time * 1000);
|
||||||
pain_killer_lastingtime += std::min(item_meta->time() * 1000,
|
pain_killer_lastingtime += std::min(item_meta->time() * 1000,
|
||||||
anodyne_max_time * 1000 - left_time) / 1000;
|
anodyne_max_time * 1000 - left_time) / 1000;
|
||||||
@ -2169,14 +2193,28 @@ void Human::ProcUseItemAction()
|
|||||||
pain_killer_frameno = room->GetFrameNo();
|
pain_killer_frameno = room->GetFrameNo();
|
||||||
pain_killer_lastingtime = item_meta->time();
|
pain_killer_lastingtime = item_meta->time();
|
||||||
if (pain_killer_lastingtime > 0) {
|
if (pain_killer_lastingtime > 0) {
|
||||||
auto heal = item_meta->heal();
|
|
||||||
pain_killer_timer = room->xtimer.SetIntervalWpEx
|
pain_killer_timer = room->xtimer.SetIntervalWpEx
|
||||||
(
|
(
|
||||||
SERVER_FRAME_RATE,
|
SERVER_FRAME_RATE,
|
||||||
[this, heal] (int event, const a8::Args* args)
|
[this, item_meta] (int event, const a8::Args* args)
|
||||||
{
|
{
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
if (a8::TIMER_EXEC_EVENT == event) {
|
||||||
AddHp(heal);
|
switch (std::get<0>(item_meta->_heal)) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
AddHp(std::get<1>(item_meta->_heal));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
AddHp(std::get<1>(item_meta->_heal) * GetMaxHP());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (room->GetFrameNo() - pain_killer_frameno >
|
if (room->GetFrameNo() - pain_killer_frameno >
|
||||||
pain_killer_lastingtime * SERVER_FRAME_RATE) {
|
pain_killer_lastingtime * SERVER_FRAME_RATE) {
|
||||||
room->xtimer.Delete(pain_killer_timer);
|
room->xtimer.Delete(pain_killer_timer);
|
||||||
@ -2185,45 +2223,60 @@ void Human::ProcUseItemAction()
|
|||||||
},
|
},
|
||||||
&xtimer_attacher);
|
&xtimer_attacher);
|
||||||
}
|
}
|
||||||
AddHp(item_meta->heal());
|
switch (std::get<0>(item_meta->_heal)) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
AddHp(std::get<1>(item_meta->_heal));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
AddHp(std::get<1>(item_meta->_heal) * GetMaxHP());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DecInventory(item_meta->_inventory_slot(), 1);
|
DecInventory(item_meta->_inventory_slot(), 1);
|
||||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||||
GetTrigger()->UseItemAction(action_item_id);
|
GetTrigger()->UseItemAction(item_meta->_inventory_slot());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IS_SHEN_BAO:
|
case IS_SHEN_BAO:
|
||||||
{
|
{
|
||||||
+stats.use_medicine_times;
|
+stats.use_medicine_times;
|
||||||
if (!shen_bao_timer.expired()) {
|
if (!dead && downed) {
|
||||||
a8::Args args({item_meta->time()});
|
downed = false;
|
||||||
room->xtimer.FireEvent(shen_bao_timer, kShenBaoAddTimeTimerEvent, &args);
|
if (!downed_timer.expired()) {
|
||||||
} else {
|
room->xtimer.Delete(downed_timer);
|
||||||
int exec_time = 0;
|
}
|
||||||
int total_time = item_meta->time();
|
if (GetBuffById(kDownBuffId)) {
|
||||||
int heal = item_meta->heal();
|
RemoveBuffById(kDownBuffId);
|
||||||
shen_bao_timer = room->xtimer.SetIntervalWpEx
|
}
|
||||||
(
|
SyncAroundPlayers(__FILE__, __LINE__, __func__);
|
||||||
SERVER_FRAME_RATE,
|
switch (std::get<0>(item_meta->_heal)) {
|
||||||
[this, exec_time, total_time, heal] (int event, const a8::Args* args) mutable
|
case 1:
|
||||||
{
|
{
|
||||||
if (a8::TIMER_EXEC_EVENT == event) {
|
AddHp(std::get<1>(item_meta->_heal));
|
||||||
exec_time += 1;
|
}
|
||||||
if (exec_time >= total_time || dead) {
|
break;
|
||||||
room->xtimer.DeleteCurrentTimer();
|
case 2:
|
||||||
} else {
|
{
|
||||||
AddHp(heal);
|
AddHp(std::get<1>(item_meta->_heal) * GetMaxHP());
|
||||||
}
|
}
|
||||||
} else if (kShenBaoAddTimeTimerEvent == event) {
|
break;
|
||||||
total_time += args->Get<int>(0);
|
default:
|
||||||
}
|
{
|
||||||
},
|
}
|
||||||
&xtimer_attacher);
|
break;
|
||||||
AddHp(heal);
|
}
|
||||||
}
|
}
|
||||||
DecInventory(item_meta->_inventory_slot(), 1);
|
DecInventory(item_meta->_inventory_slot(), 1);
|
||||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||||
GetTrigger()->UseItemAction(action_item_id);
|
GetTrigger()->UseItemAction(item_meta->_inventory_slot());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -174,6 +174,15 @@ namespace mt
|
|||||||
_hit_buff_list.push_back(a8::XValue(str));
|
_hit_buff_list.push_back(a8::XValue(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
_heal = std::make_tuple<int, float>(0, 0.0f);
|
||||||
|
std::vector<std::string> strings;
|
||||||
|
a8::Split(hit_buff(), strings, ':');
|
||||||
|
if (strings.size() > 1) {
|
||||||
|
_heal = std::make_tuple<int, float>(a8::XValue(strings[0]).GetInt(),
|
||||||
|
a8::XValue(strings[1]).GetDouble());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Equip::Init2()
|
void Equip::Init2()
|
||||||
|
@ -29,6 +29,7 @@ namespace mt
|
|||||||
int _car_deactive_buff_id = 0;
|
int _car_deactive_buff_id = 0;
|
||||||
long long _special_damage_type = 0;
|
long long _special_damage_type = 0;
|
||||||
int _group_id = 0;
|
int _group_id = 0;
|
||||||
|
std::tuple<int, float> _heal;
|
||||||
|
|
||||||
void Init1();
|
void Init1();
|
||||||
void Init2();
|
void Init2();
|
||||||
|
@ -26,7 +26,7 @@ namespace mtb
|
|||||||
int bullet_speed() const { return bullet_speed_; };
|
int bullet_speed() const { return bullet_speed_; };
|
||||||
int range() const { return range_; };
|
int range() const { return range_; };
|
||||||
int use_time() const { return use_time_; };
|
int use_time() const { return use_time_; };
|
||||||
int heal() const { return heal_; };
|
const std::string heal() const { return heal_; };
|
||||||
int time() const { return time_; };
|
int time() const { return time_; };
|
||||||
const std::string volume() const { return volume_; };
|
const std::string volume() const { return volume_; };
|
||||||
int bullet_rad() const { return bullet_rad_; };
|
int bullet_rad() const { return bullet_rad_; };
|
||||||
@ -160,7 +160,7 @@ namespace mtb
|
|||||||
int bullet_speed_ = 0;
|
int bullet_speed_ = 0;
|
||||||
int range_ = 0;
|
int range_ = 0;
|
||||||
int use_time_ = 0;
|
int use_time_ = 0;
|
||||||
int heal_ = 0;
|
std::string heal_;
|
||||||
int time_ = 0;
|
int time_ = 0;
|
||||||
std::string volume_;
|
std::string volume_;
|
||||||
int bullet_rad_ = 0;
|
int bullet_rad_ = 0;
|
||||||
|
@ -239,7 +239,7 @@ namespace mtb
|
|||||||
meta_class->SetSimpleField(13, "bullet_speed", a8::reflect::ET_INT32, my_offsetof2(Equip, bullet_speed_));
|
meta_class->SetSimpleField(13, "bullet_speed", a8::reflect::ET_INT32, my_offsetof2(Equip, bullet_speed_));
|
||||||
meta_class->SetSimpleField(14, "range", a8::reflect::ET_INT32, my_offsetof2(Equip, range_));
|
meta_class->SetSimpleField(14, "range", a8::reflect::ET_INT32, my_offsetof2(Equip, range_));
|
||||||
meta_class->SetSimpleField(15, "use_time", a8::reflect::ET_INT32, my_offsetof2(Equip, use_time_));
|
meta_class->SetSimpleField(15, "use_time", a8::reflect::ET_INT32, my_offsetof2(Equip, use_time_));
|
||||||
meta_class->SetSimpleField(16, "heal", a8::reflect::ET_INT32, my_offsetof2(Equip, heal_));
|
meta_class->SetSimpleField(16, "heal", a8::reflect::ET_STRING, my_offsetof2(Equip, heal_));
|
||||||
meta_class->SetSimpleField(17, "time", a8::reflect::ET_INT32, my_offsetof2(Equip, time_));
|
meta_class->SetSimpleField(17, "time", a8::reflect::ET_INT32, my_offsetof2(Equip, time_));
|
||||||
meta_class->SetSimpleField(18, "volume", a8::reflect::ET_STRING, my_offsetof2(Equip, volume_));
|
meta_class->SetSimpleField(18, "volume", a8::reflect::ET_STRING, my_offsetof2(Equip, volume_));
|
||||||
meta_class->SetSimpleField(19, "bullet_rad", a8::reflect::ET_INT32, my_offsetof2(Equip, bullet_rad_));
|
meta_class->SetSimpleField(19, "bullet_rad", a8::reflect::ET_INT32, my_offsetof2(Equip, bullet_rad_));
|
||||||
|
@ -981,14 +981,45 @@ void Human::FillMFActivePlayerData(cs::MFActivePlayerData* player_data)
|
|||||||
int action_param = 0;
|
int action_param = 0;
|
||||||
switch (action_item_id) {
|
switch (action_item_id) {
|
||||||
case IS_HEALTHKIT:
|
case IS_HEALTHKIT:
|
||||||
|
case IS_SHEN_BAO:
|
||||||
{
|
{
|
||||||
action_param = item_meta->heal();
|
switch (std::get<0>(item_meta->_heal)) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
action_param = std::get<1>(item_meta->_heal);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
action_param = std::get<1>(item_meta->_heal) * GetMaxHP();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IS_PAIN_KILLER:
|
case IS_PAIN_KILLER:
|
||||||
case IS_SHEN_BAO:
|
|
||||||
{
|
{
|
||||||
action_param = item_meta->heal() * item_meta->time();
|
switch (std::get<0>(item_meta->_heal)) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
action_param = std::get<1>(item_meta->_heal) * item_meta->time();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
action_param = std::get<1>(item_meta->_heal) * GetMaxHP()
|
||||||
|
* item_meta->time();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -445,14 +445,17 @@ void Player::UpdateUseItemIdx()
|
|||||||
1.5);
|
1.5);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
GetTrigger()->UseItemAction(use_item_idx);
|
GetTrigger()->UseItemAction(use_item_idx);
|
||||||
|
#endif
|
||||||
use_time *= 1 - GetAbility()->GetAttrRate(kHAT_DrugTime);
|
use_time *= 1 - GetAbility()->GetAttrRate(kHAT_DrugTime);
|
||||||
use_time -= GetAbility()->GetAttrAbs(kHAT_DrugTime);
|
use_time -= GetAbility()->GetAttrAbs(kHAT_DrugTime);
|
||||||
use_time = std::max(1, use_time);
|
use_time = std::max(1, use_time);
|
||||||
StartAction(
|
StartAction(
|
||||||
AT_UseItem,
|
AT_UseItem,
|
||||||
use_time,
|
use_time,
|
||||||
use_item_idx,
|
//use_item_idx,
|
||||||
|
item_meta->id(),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1040,6 +1043,13 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
|
|||||||
room->SetInfiniteBulletMode();
|
room->SetInfiniteBulletMode();
|
||||||
} else if (cmd == "watchwar") {
|
} else if (cmd == "watchwar") {
|
||||||
AsyncRequestWatchWar(false);
|
AsyncRequestWatchWar(false);
|
||||||
|
} else if (cmd == "killself") {
|
||||||
|
float dmg_out = 0;
|
||||||
|
float dmg = GetMaxHP() + 10;
|
||||||
|
DecHP(dmg, VP_Gas, TEXT("battle_server_killer_gas", "毒圈"), VW_Gas,
|
||||||
|
VP_Gas,
|
||||||
|
TEXT("battle_server_killer_gas", "毒圈"),
|
||||||
|
dmg_out);
|
||||||
} else if (cmd == "shuaguai" && cmds.size() >= 3) {
|
} else if (cmd == "shuaguai" && cmds.size() >= 3) {
|
||||||
int hero_id = a8::XValue(cmds[1]);
|
int hero_id = a8::XValue(cmds[1]);
|
||||||
int hero_num = a8::XValue(cmds[2]);
|
int hero_num = a8::XValue(cmds[2]);
|
||||||
|
@ -156,7 +156,7 @@ message Equip
|
|||||||
optional int32 bullet_speed = 13; //子弹速度
|
optional int32 bullet_speed = 13; //子弹速度
|
||||||
optional int32 range = 14; //射程
|
optional int32 range = 14; //射程
|
||||||
optional int32 use_time = 15; //使用时间
|
optional int32 use_time = 15; //使用时间
|
||||||
optional int32 heal = 16; //瞬间生命恢复
|
optional string heal = 16; //瞬间生命恢复
|
||||||
optional int32 time = 17; //时间
|
optional int32 time = 17; //时间
|
||||||
optional string volume = 19; //装备容量
|
optional string volume = 19; //装备容量
|
||||||
optional int32 bullet_rad = 20; //子弹半径
|
optional int32 bullet_rad = 20; //子弹半径
|
||||||
|
Loading…
x
Reference in New Issue
Block a user