- Dołączył
- Czerwiec 6, 2011
- Posty
- 308
- Liczba reakcji
- 35
Witam,
Jak zapewne wszyscy si? domy?lacie jest to "anty-anty parali?"
Kod testowany na TFS 0.4, wszystko pi?knie dzia?a.
W creature.h poni?ej tego kodu:
wklej:
W configmanager.h powy?ej:
wklej:
W configmanager.cpp powy?ej:
wklej:
W creature.cpp:
poni?ej:
wklej:
poni?ej:
wklej:
Nast?pnie na koniec pliku wklej:
poni?ej:
wklej:
poni?ej:
wklej:
W config.lua wklej:
A tutaj macie paralyze rune:
Kody zosta?y zaczerpni?te z innych for i posklejane w ca?o??. Jak co? nie b?dzie chodzi?o prosz? pisa? tutaj, b?d? PW.
Jak zapewne wszyscy si? domy?lacie jest to "anty-anty parali?"
Kod testowany na TFS 0.4, wszystko pi?knie dzia?a.
W creature.h poni?ej tego kodu:
Kod:
friend class LuaScriptInterface;
Kod:
uint64_t addParalyzeTime;
uint32_t antiParalsUnderTime;
void removeParalyze();
Kod:
LAST_NUMBER_CONFIG
Kod:
PARAL_SLOW,
PARAL_MIN_TIME,
PARAL_CHECKS,
Kod:
m_loaded = true;
Kod:
m_confNumber[PARAL_SLOW] = getGlobalNumber("paralyzeSlow", 10);
m_confNumber[PARAL_MIN_TIME] = getGlobalNumber("paralyzeMinTime", 200);
m_confNumber[PARAL_CHECKS] = getGlobalNumber("paralyzeChecks", 3);
poni?ej:
Kod:
void Creature::removeCondition(ConditionType_t type)
{
Kod:
if(type == CONDITION_PARALYZE)
removeParalyze();
Kod:
void Creature::removeCondition(Condition* condition)
{
Kod:
if(condition->getType() == CONDITION_PARALYZE)
removeParalyze();
Kod:
void Creature::removeParalyze()
{
if(OTSYS_TIME() - addParalyzeTime > g_config.getNumber(ConfigManager::PARAL_MIN_TIME))
return;
addParalyzeTime = 0;
++antiParalsUnderTime;
if(antiParalsUnderTime > g_config.getNumber(ConfigManager::PARAL_CHECKS) && getBaseSpeed() > g_config.getNumber(ConfigManager::PARAL_SLOW))
setBaseSpeed((uint32_t) getBaseSpeed() - (getBaseSpeed() / 100 * g_config.getNumber(ConfigManager::PARAL_SLOW)));
std::cout << getName() << " bot-antiparalyze " << antiParalsUnderTime << " times, basespeed: " << getBaseSpeed() << std::endl;
}
Kod:
onIdleStatus();
Kod:
addParalyzeTime = 0;
antiParalsUnderTime = 0;
Kod:
if(condition->startCondition(this))
{
conditions.push_back(condition);
onAddCondition(condition->getType());
Kod:
if(condition->getType() == CONDITION_PARALYZE)
addParalyzeTime = OTSYS_TIME();
Kod:
paralyzeSlow = 10
paralyzeMinTime = 200
paralyzeChecks = 3
Kod:
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 20000)
setConditionFormula(condition, -0.9, 40, -0.9, 0)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (not (isDruid(cid) or isSorcerer(cid))) and (getPlayerGroupId(cid) <= 3) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation cannot use this rune.")
return FALSE
end
if (getPlayerMana(cid) < 700) and (getPlayerGroupId(cid) <= 3) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enough mana points.")
return FALSE
end
if (not (isPlayer(itemEx.uid))) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You may use paralyze only on players.")
return FALSE
end
if(getTilePzInfo(getCreaturePosition(cid)) == TRUE or getTilePzInfo(getCreaturePosition(itemEx.uid)) == TRUE) and (getPlayerGroupId(cid) <= 3) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't paralyze in protection zone.")
return FALSE
end
doAddCondition(itemEx.uid, condition)
doPlayerAddMana(cid, -700)
if(item.type > 1) then
doTransformItem(item.uid, item.itemid, item.type-1)
else
doRemoveItem(item.uid)
end
return true
end
| Notka moderatorska: |
Done ![]() |
