struct AMOUNT_INFO { unsigned time; int amount; }; class CharacterInfo { // ... int ATKPercent, DEFPercent, MATKPercent, MDEFPercent; } class CPCBattle { // ... std::map m_ATKPercentList; // key = skid }; void CPCBattle::SetATKPercentInfo(_SKILL_ID skid, unsigned duration, int val) { auto info = &m_pc->m_characterInfo; auto entry = info.find(skid); if (auto entry = m_ATKPercentList.find(skid); entry != m_ATKPercentList.end()) { auto entry_amount = entry->second.amount; if (std::abs(val) < std::abs(entry_amount)) return; info->ATKPercent -= entry_amount; } auto stored = info->ATKPercent; if (stored + val < 0) val = -stored; unsigned timeout = 9999; info->ATKPercent = val + stored; if (duration != 9999) timeout = timeGetTime() + duration; auto pair = m_ATKPercentList[skid]; pair->time = timeout; pair->amount = val; Trace("%s's ATKPercent: %d\n", info->characterName, info->ATKPercent); m_pc->NotifyParameter(VARR_ATTPOWER, 0); }