📄 battlemanager.cpp
字号:
::CastMe2Other(idCaster, &m_packet);
} //> CSD-TW-030606
void CBattleManager::RecvCombatResult(WORD idCaster, t_client_combat_result* pPacket)
{ //
const BYTE nCombat = pPacket->nSkill; // 傈捧胶懦 锅龋
const WORD idTarget = pPacket->idTarget;
CHARLIST* pCaster = ::GetCharListPtr(idCaster);
CHARLIST* pTarget = ::GetCharListPtr(idTarget);
if (pCaster == NULL || pTarget == NULL) return;
// 辑肺 傍拜 啊瓷咯何 八荤
if (!IsBattle()) return;
if (!IsBattle(pCaster)) return;
if (!IsBattle(pCaster, pTarget)) return;
if (!FilterCombat(nCombat, pCaster, pTarget)) return;
pTarget->SetWanted(pPacket->bWanted); // 泅惑裹牢瘤 咯何 汲沥
const int nType = Magic_Ref[nCombat].order_Type;
const int nBattle = (nType/10) + (nType%10);
const int nX = pPacket->nX; // 傈捧胶懦捞 惯积等 困摹狼 X谅钎
const int nY = pPacket->nY; // 傈捧胶懦捞 惯积等 困摹狼 Y谅钎
GetBattle(nBattle)->SetIndex(nCombat);
GetBattle(nBattle)->SetBothID(idCaster, idTarget);
GetBattle(nBattle)->SetBothPtr(pCaster, pTarget);
GetBattle(nBattle)->SetCurrentTime(g_curr_time);
GetBattle(nBattle)->SetContinueTime(0);
GetBattle(nBattle)->SetPosition(nX>>5, nY>>5);
GetBattle(nBattle)->Execute();
}
///////////////////////////////////////////////////////////////////////////////
// Protected Method
///////////////////////////////////////////////////////////////////////////////
void CBattleManager::AutoCurse(WORD idCaster, WORD idTarget)
{ //
CHARLIST* pCaster = ::GetCharListPtr(idCaster);
CHARLIST* pTarget = ::GetCharListPtr(idTarget);
if (pCaster == NULL || pTarget == NULL) return;
if (rand()%101 >= 5) return;
int nMagic = 0, nContinue = 0;
// 历林拌凯狼 饭绢 酒捞袍
const int nStiff = RareEM.GetStaticRareStiff(pCaster->StaticRare); // 籍拳
const int nSnag = RareEM.GetStaticRareSnag(pCaster->StaticRare); // 例措付厚
const int nVertigly = RareEM.GetStaticRareVertigly(pCaster->StaticRare); // 去鄂
const int nPoison = RareEM.GetStaticRarePoison(pCaster->StaticRare); // 吝刀
const int nSlack = RareEM.GetStaticRareSlack(pCaster->StaticRare); // 加档历窍
if (nStiff > 0)
{
nMagic = STONELY;
nContinue = nStiff;
}
else if (nSnag > 0)
{
nMagic = ABSOLUTE_PARALYSIS;
nContinue = nSnag;
}
else if (nVertigly > 0)
{
nMagic = CONFUSION;
nContinue = nVertigly;
}
else if (nPoison > 0)
{
nMagic = INTOXICATION;
nContinue = nPoison;
}
else if (nSlack > 0)
{
nMagic = SLOW;
nContinue = nStiff;
}
if (nMagic > 0)
{
const BYTE nType = Magic_Ref[nMagic].magic_Type;
// 付过阑 利侩且 荐 绝绰 版快
if (!IsApply(nType, pCaster, pTarget))
{
return;
}
// 付过捞 角菩茄 版快扼搁
if (IsMissMagic(nType, pCaster, pTarget))
{
return;
}
const int nBattle = Magic_Ref[nMagic].magic_Type/10;
GetBattle(nBattle)->SetIndex(nMagic);
GetBattle(nBattle)->SetBothID(idCaster, idTarget);
GetBattle(nBattle)->SetBothPtr(pCaster, pTarget);
GetBattle(nBattle)->SetCurrentTime(g_curr_time);
GetBattle(nBattle)->SetContinueTime(nContinue);
GetBattle(nBattle)->Execute();
}
}
bool CBattleManager::FilterNpcAttack(CHARLIST* pCaster, CHARLIST* pTarget)
{ //< CSD-030723
// 父距 捞悼俊 傍拜茄芭扼搁 力磊府俊 肛勉(NPC俊霸父 利侩)
pCaster->MoveLength = pCaster->MovePathCount = 0;
// 滚弊各俊 措茄 烙矫 规祈
if (!IsBugMon(pCaster, pTarget)) return false;
// 傍拜捞 阂啊茄 版快扼搁
if (!::CanBattleArea(pCaster, pTarget)) return false;
// 家券阁篮 牢埃 NPC甫 磷老 荐 绝澜
if (pCaster->IsTamedNpc() && pTarget->IsNpc())
{
switch (pTarget->Race)
{
case HUMAN:
{
return false;
}
case SEALSTONE:
{
return IsBreak(pCaster, pTarget);
}
}
}
return (IsMissAttack(pCaster, pTarget)) ? false:true;
} //> CSD-030723
bool CBattleManager::FilterAttack(CHARLIST* pCaster, CHARLIST* pTarget)
{
// 滚弊各俊 措茄 烙矫 规祈
if (!IsBugMon(pCaster, pTarget)) return false;
// 傍拜捞 阂啊茄 版快扼搁
if (!::CanBattleArea(pCaster, pTarget))
{
pCaster->Message(MK_WARNING, 1, 4);
return false;
}
// 必厩 NK扼搁 拱府利 傍拜 阂啊
if (pCaster->IsUltraNK(MapInfo[MapNumber].nation))
{
::OutMessage(pCaster, 1, 18);
return false;
}
// NPC牢 版快扼搁
if (pTarget->IsNpc())
{
switch (pTarget->Race)
{
case HUMAN:
{ //< CSD-021019
t_client_event data;
data.type = EVENT_TYPE_NPC;
data.event_no = pTarget->GetServerID() + 10000;
RecvEvent( &data, pCaster->GetServerID());
return false;
} //> CSD-021019
case SEALSTONE:
{
return IsBreak(pCaster, pTarget);
}
}
}
if (IsColleague(pCaster, pTarget))
{
return false;
}
// 1 : 绊 -> 历, 2 : 历 -> 绊, 3 : 鞍篮 臭捞
const int nX = pTarget->MoveSx;
const int nY = pTarget->MoveSy;
const BYTE nRiseFall = pCaster->GetRiseFall(nX, nY);
switch (pCaster->GetTacticsKind())
{
case TACTICS_Archery: // 劝筋扁
case TACTICS_Hurl: // 厚八 带瘤扁
{ // 厘芭府 公扁
return true;
}
case TACTICS_Whirl:
case TACTICS_Pierce:
case TACTICS_Magery:
case TACTICS_Orison:
{ // 吝芭府 公扁
return (nRiseFall == 3) ? true:false; // 臭捞啊 促福促搁 角菩
}
default:
{ // 窜芭府 公扁
return (nRiseFall == 3) ? true:false; // 臭捞啊 促福促搁 角菩
}
}
return true;
}
bool CBattleManager::FilterThrow(CHARLIST* pCaster, CHARLIST* pTarget)
{
if (pTarget->IsNpc())
{ // NPC牢 版快扼搁
switch (pTarget->Race)
{
case HUMAN: return false;
case SEALSTONE: return IsBreak(pCaster, pTarget);
}
}
// 墨款伎矾牢 版快扼搁
if (pTarget->IsCounselor()) return false;
if (pTarget->accessory[0] == 114) return false;
// 滚弊阁俊 措茄 烙矫 规祈
if (!IsBugMon(pCaster, pTarget)) return false;
// 悼丰牢 版快扼搁
if (IsColleague(pCaster, pTarget))
{
return false;
}
return true;
}
bool CBattleManager::FilterNpcMagic(BYTE nMagic, CHARLIST* pCaster, CHARLIST* pTarget, int nX, int nY)
{ //< CSD-030723
if (pTarget->IsNpc())
{ // NPC牢 版快扼搁
switch (pTarget->Race)
{
case HUMAN:
{
return false;
}
case SEALSTONE:
{
return IsBreak(pCaster, pTarget);
}
}
}
// 付过 矫傈捞 阂啊茄 惑怕唱 瓷仿捞唱 付唱啊 何练茄 惑怕牢 版快
if (!IsEnable(nMagic, pCaster))
{
return false;
}
const BYTE nType = Magic_Ref[nMagic].magic_Type;
// 付过阑 利侩且 荐 绝绰 版快
if (!IsApply(nType, pCaster, pTarget))
{
return false;
}
// 付过捞 角菩茄 版快扼搁
if (IsMissMagic(nType, pCaster, pTarget))
{
return false;
}
return true;
} //> CSD-030723
bool CBattleManager::FilterStart(CHARLIST* pCaster)
{ //
// 混府扁 付过 荤侩 阂啊 八荤
const BYTE nMagic = pCaster->GetMagic();
if (IsValid(nMagic, pCaster) == false) return false;
if (nMagic == RELIEF_AUTHORITY && CheckEventWarDoing()) return false;
const int nX = pCaster->MoveSx;
const int nY = pCaster->MoveSy;
// 付过 荤侩 阂啊 瘤开牢 版快
if (!IsPlaceMagic(nMagic, nX, nY))
{
pCaster->Message(MK_WARNING, 1, 4);
return false;
}
const BYTE nType = Magic_Ref[nMagic].magic_Type;
if (nType == MapInfo[MapNumber].nDisableMagicType)
{ //< CSD-030516
pCaster->Message(MK_WARNING, 1, 44);
return false;
} //> CSD-030516
// 付过阑 荤侩且荐 绝霸 秦档 Counselor绰 付过 荤侩 啊瓷
if (g_block_magic && !pCaster->IsCounselor())
{
pCaster->Message(MK_WARNING, 1, 4);
return false;
}
// 必厩 NK扼搁 付过 荤侩捞 阂啊
if (pCaster->IsUltraNK(MapInfo[MapNumber].nation))
{
pCaster->Message(MK_WARNING, 1, 5);
return false;
}
// 付过 矫傈捞 阂啊茄 惑怕唱 瓷仿捞唱 付唱啊 何练茄 惑怕牢 版快
if (!IsAbility(nMagic, pCaster) || !IsEnable(nMagic, pCaster))
{
return false;
}
return true;
}
bool CBattleManager::FilterMagic(CHARLIST* pCaster, CHARLIST* pTarget, int nX, int nY)
{ // 付过 荤侩捞 啊瓷茄瘤 八荤
const BYTE nMagic = pCaster->GetMagic(); // 付过狼 锅龋
if (!IsValid(nMagic, pCaster)) return false;
if (!IsAbility(nMagic, pCaster)) return false;
// NPC牢 版快扼搁 捞肺款 付过阑 荤侩茄 版快 付过 利侩 阂啊
if (pTarget->IsNpc())
{
if (!IsHarmfulMagic(nMagic))
{
pCaster->Message(MK_NORMAL, 1, 17);
return false;
}
}
// 付过 荤侩 蜡瓤芭府 八荤
if (Magic_Ref[nMagic].avail_Range != 0)
{
if (pCaster->GetDistance(nX, nY) > Magic_Ref[nMagic].avail_Range)
{
pCaster->Message(MK_NORMAL, 1, 19);
return false;
}
}
// 1 : 绊 -> 历, 2 : 历 -> 绊, 3 : 鞍篮 臭捞
const BYTE nRiseFall = pCaster->GetRiseFall(nX>>5, nY>>5);
switch (Magic_Ref[nMagic].nRiseFall)
{
case 1:
{ // 鞍篮 臭捞父 傍拜捞 啊瓷茄 版快
if (nRiseFall == 1 || nRiseFall == 2)
{
pCaster->Message(MK_NORMAL, 1, 20);
return false;
}
break;
}
case 2:
{ // 绊->历客 鞍篮 臭捞父 傍拜捞 啊瓷茄 版快
if (nRiseFall == 2)
{
pCaster->Message(MK_NORMAL, 1, 20);
return false;
}
break;
}
case 3:
{ // 历->绊客 鞍篮 臭捞父 傍拜捞 啊瓷茄 版快
if (nRiseFall == 1)
{
pCaster->Message(MK_NORMAL, 1, 20);
return false;
}
break;
}
}
const BYTE nType = Magic_Ref[nMagic].magic_Type;
// 付过阑 利侩且 荐 绝绰 版快
if (!IsApply(nType, pCaster, pTarget))
{
return false;
}
// 付过捞 角菩茄 版快扼搁
if (IsMissMagic(nType, pCaster, pTarget))
{
return false;
}
pCaster->DecMana(Magic_Ref[nMagic].exhaust_MP);
return true;
}
bool CBattleManager::FilterCombat(BYTE nCombat, CHARLIST* pCaster, CHARLIST* pTarget, int nX, int nY)
{ //< CSD-TW-030606
if (pCaster->IsRecoveryCombatState())
{ // cp雀汗拌凯 付过捞 惯悼吝老锭绰 酒公巴档 且 荐 绝澜 // 030430 kyo
pCaster->Message(MK_INFORMATION, 1, 43);
return false;
}
// 傍拜捞 阂啊茄 版快扼搁
if (!::CanBattleArea(pCaster, pTarget))
{
pCaster->Message(MK_WARNING, 1, 4);
return false;
}
// 必厩 NK扼搁 付过 荤侩捞 阂啊
if (pCaster->IsUltraNK(MapInfo[MapNumber].nation))
{
pCaster->Message(MK_WARNING, 1, 5);
return false;
}
// 傈捧胶懦 荤侩 蜡瓤芭府 八荤
if (Magic_Ref[nCombat].avail_Range != 0)
{
switch (nCombat)
{
case CHARGING:
{
const int nTemp = pCaster->GetDistance(nX, nY);
if (pCaster->GetDistance(nX, nY) > pCaster->GetCombatValue(nCombat))
{
pCaster->Message(MK_NORMAL, 1, 72);
return false;
}
break;
}
default:
{
if (pCaster->GetDistance(nX, nY) > Magic_Ref[nCombat].avail_Range)
{
pCaster->Message(MK_NORMAL, 1, 72);
return false;
}
break;
}
}
}
// 1 : 绊 -> 历, 2 : 历 -> 绊, 3 : 鞍篮 臭捞
const BYTE nRiseFall = pCaster->GetRiseFall(nX>>5, nY>>5);
switch (Magic_Ref[nCombat].nRiseFall)
{
case 1:
{ // 鞍篮 臭捞父 傍拜捞 啊瓷茄 版快
if (nRiseFall == 1 || nRiseFall == 2)
{
//pCaster->Message(MK_NORMAL, 1, 20);
return false;
}
break;
}
case 2:
{ // 绊->历客 鞍篮 臭捞父 傍拜捞 啊瓷茄 版快
if (nRiseFall == 2)
{
//pCaster->Message(MK_NORMAL, 1, 20);
return false;
}
break;
}
case 3:
{ // 历->绊客 鞍篮 臭捞父 傍拜捞 啊瓷茄 版快
if (nRiseFall == 1)
{
//pCaster->Message(MK_NORMAL, 1, 20);
return false;
}
break;
}
}
const BYTE nType = Magic_Ref[nCombat].magic_Type;
// 付过阑 利侩且 荐 绝绰 版快
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -