1
This commit is contained in:
parent
4148a80d83
commit
cb4307018f
@ -10,7 +10,7 @@
|
|||||||
static void IncIntMap(std::map<int, int>& int_map, int key)
|
static void IncIntMap(std::map<int, int>& int_map, int key)
|
||||||
{
|
{
|
||||||
auto itr = int_map.find(key);
|
auto itr = int_map.find(key);
|
||||||
if (itr == int_map.end()) {
|
if (itr != int_map.end()) {
|
||||||
++itr->second;
|
++itr->second;
|
||||||
} else {
|
} else {
|
||||||
int_map[key] = 1;
|
int_map[key] = 1;
|
||||||
@ -20,7 +20,7 @@ static void IncIntMap(std::map<int, int>& int_map, int key)
|
|||||||
static void DecIntMap(std::map<int, int>& int_map, int key)
|
static void DecIntMap(std::map<int, int>& int_map, int key)
|
||||||
{
|
{
|
||||||
auto itr = int_map.find(key);
|
auto itr = int_map.find(key);
|
||||||
if (itr == int_map.end()) {
|
if (itr != int_map.end()) {
|
||||||
--itr->second;
|
--itr->second;
|
||||||
if (itr->second < 0) {
|
if (itr->second < 0) {
|
||||||
itr->second = 0;
|
itr->second = 0;
|
||||||
@ -28,6 +28,16 @@ static void DecIntMap(std::map<int, int>& int_map, int key)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int GetIntMap(std::map<int, int>& int_map, int key)
|
||||||
|
{
|
||||||
|
auto itr = int_map.find(key);
|
||||||
|
if (itr != int_map.end()) {
|
||||||
|
return itr->second;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InGameVoice::InGameVoice(Room* room)
|
InGameVoice::InGameVoice(Room* room)
|
||||||
{
|
{
|
||||||
room_ = room;
|
room_ = room;
|
||||||
@ -285,16 +295,106 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
|
|||||||
{
|
{
|
||||||
bool is_first_boold = global_kills_ == 1;
|
bool is_first_boold = global_kills_ == 1;
|
||||||
{
|
{
|
||||||
|
int val = global_kills_;
|
||||||
mt::InGameVoice::Traverse
|
mt::InGameVoice::Traverse
|
||||||
(
|
(
|
||||||
room_->IsMobaModeRoom(),
|
room_->IsMobaModeRoom(),
|
||||||
InGameVoiceEventType_e::kGlobalKills,
|
InGameVoiceEventType_e::kGlobalKills,
|
||||||
[this, killer, deader] (const mt::InGameVoice* meta) -> bool
|
[this, killer, deader, val] (const mt::InGameVoice* meta) -> bool
|
||||||
{
|
{
|
||||||
if (meta->MatchCond(global_kills_)) {
|
if (meta->MatchCond(val)) {
|
||||||
Notify(killer, deader, meta);
|
Notify(killer, deader, meta);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
if (!is_first_boold) {
|
||||||
|
int val = GetIntMap(personal_kills_, killer->GetUniId());
|
||||||
|
mt::InGameVoice::Traverse
|
||||||
|
(
|
||||||
|
room_->IsMobaModeRoom(),
|
||||||
|
InGameVoiceEventType_e::kPersonalExceptFirstBooldKills,
|
||||||
|
[this, killer, deader, val] (const mt::InGameVoice* meta) -> bool
|
||||||
|
{
|
||||||
|
if (meta->MatchCond(val)) {
|
||||||
|
Notify(killer, deader, meta);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (!is_first_boold) {
|
||||||
|
mt::InGameVoice::Traverse
|
||||||
|
(
|
||||||
|
room_->IsMobaModeRoom(),
|
||||||
|
InGameVoiceEventType_e::kMyTeamateBeKill,
|
||||||
|
[this, killer, deader] (const mt::InGameVoice* meta) -> bool
|
||||||
|
{
|
||||||
|
Notify(killer, deader, meta);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (!is_first_boold) {
|
||||||
|
mt::InGameVoice::Traverse
|
||||||
|
(
|
||||||
|
room_->IsMobaModeRoom(),
|
||||||
|
InGameVoiceEventType_e::kEnemyTeamBekill,
|
||||||
|
[this, killer, deader] (const mt::InGameVoice* meta) -> bool
|
||||||
|
{
|
||||||
|
Notify(killer, deader, meta);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (!is_first_boold) {
|
||||||
|
if (deader->GetTeam()->AllIsDead()) {
|
||||||
|
mt::InGameVoice::Traverse
|
||||||
|
(
|
||||||
|
room_->IsMobaModeRoom(),
|
||||||
|
InGameVoiceEventType_e::kTeamAllDead,
|
||||||
|
[this, killer, deader] (const mt::InGameVoice* meta) -> bool
|
||||||
|
{
|
||||||
|
Notify(killer, deader, meta);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (!is_first_boold) {
|
||||||
|
int val = GetIntMap(personal_series_kills_, killer->GetUniId());
|
||||||
|
mt::InGameVoice::Traverse
|
||||||
|
(
|
||||||
|
room_->IsMobaModeRoom(),
|
||||||
|
InGameVoiceEventType_e::kSeriesKills,
|
||||||
|
[this, killer, deader, val] (const mt::InGameVoice* meta) -> bool
|
||||||
|
{
|
||||||
|
if (meta->MatchCond(val)) {
|
||||||
|
Notify(killer, deader, meta);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if (!is_first_boold) {
|
||||||
|
int val = GetIntMap(personal_nodead_series_kills_, killer->GetUniId());
|
||||||
|
mt::InGameVoice::Traverse
|
||||||
|
(
|
||||||
|
room_->IsMobaModeRoom(),
|
||||||
|
InGameVoiceEventType_e::kNoDeadSeriesKills,
|
||||||
|
[this, killer, deader, val] (const mt::InGameVoice* meta) -> bool
|
||||||
|
{
|
||||||
|
if (meta->MatchCond(val)) {
|
||||||
|
Notify(killer, deader, meta);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user