mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
Spells configuration version 2 (effect-based)
* Indirect spell effects loading * Json serializer improvements * spell->canBeCastAt do not allow useless cast for any spell * Added proxy caster class for spell-created obstacles * Handle damage from spell-created obstacles inside mechanics * Experimental GameState integration/regression tests * Ignore mod settings and load only "vcmi" mod when running tests * fixed https://bugs.vcmi.eu/view.php?id=2765 (with tests) * Huge improvements of BattleAI regarding spell casts * AI can cast almost any combat spell except TELEPORT, SACRIFICE and obstacle placement spells. * Possible fix for https://bugs.vcmi.eu/view.php?id=1811 * CStack factored out to several classes * [Battle] Allowed RETURN_AFTER_STRIKE effect on server side to be optional * [Battle] Allowed BattleAction have multiple destinations * [Spells] Converted limit|immunity to target condition * [Spells] Use partial configuration reload for backward compatibility handling * [Tests] Started tests for CUnitState * Partial fixes of fire shield effect * [Battle] Do HP calculations in 64 bits * [BattleAI] Use threading for spell cast evaluation * [BattleAI] Made AI be able to evaluate modified turn order (on hypothetical battle state) * Implemented https://bugs.vcmi.eu/view.php?id=2811 * plug rare freeze when hypnotized unit shots vertically * Correctly apply ONLY_MELEE_FIGHT / ONLY_DISTANCE_FIGHT for unit damage, attack & defense * [BattleAI] Try to not waste a cast if battle is actually won already * Extended JsonSerializeFormat API * fixed https://bugs.vcmi.eu/view.php?id=2847 * Any unit effect can be now chained (not only damage like Chain Lightning) ** only damage effect for now actually uses "chainFactor" * Possible quick fix for https://bugs.vcmi.eu/view.php?id=2860
This commit is contained in:
@@ -645,11 +645,6 @@ void BattleTriggerEffect::applyCl(CClient * cl)
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleTriggerEffect, *this);
|
||||
}
|
||||
|
||||
void BattleObstaclePlaced::applyCl(CClient * cl)
|
||||
{
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleObstaclePlaced, *obstacle);
|
||||
}
|
||||
|
||||
void BattleUpdateGateState::applyFirstCl(CClient * cl)
|
||||
{
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleGateStateChanged, state);
|
||||
@@ -667,30 +662,14 @@ void BattleStackMoved::applyFirstCl(CClient *cl)
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleStackMoved, movedStack, tilesToMove, distance);
|
||||
}
|
||||
|
||||
//void BattleStackAttacked::(CClient *cl)
|
||||
void BattleStackAttacked::applyFirstCl(CClient *cl)
|
||||
{
|
||||
std::vector<BattleStackAttacked> bsa;
|
||||
bsa.push_back(*this);
|
||||
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleStacksAttacked, bsa);
|
||||
}
|
||||
|
||||
void BattleAttack::applyFirstCl(CClient *cl)
|
||||
{
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleAttack, this);
|
||||
for (auto & elem : bsa)
|
||||
{
|
||||
for (int z=0; z<elem.healedStacks.size(); ++z)
|
||||
{
|
||||
elem.healedStacks[z].applyCl(cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleAttack::applyCl(CClient *cl)
|
||||
{
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleStacksAttacked, bsa);
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleStacksAttacked, bsa, battleLog);
|
||||
}
|
||||
|
||||
void StartAction::applyFirstCl(CClient *cl)
|
||||
@@ -712,7 +691,7 @@ void SetStackEffect::applyCl(CClient *cl)
|
||||
|
||||
void StacksInjured::applyCl(CClient *cl)
|
||||
{
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleStacksAttacked, stacks);
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleStacksAttacked, stacks, battleLog);
|
||||
}
|
||||
|
||||
void BattleResultsApplied::applyCl(CClient *cl)
|
||||
@@ -722,20 +701,15 @@ void BattleResultsApplied::applyCl(CClient *cl)
|
||||
callInterfaceIfPresent(cl, PlayerColor::SPECTATOR, &IGameEventsReceiver::battleResultsApplied);
|
||||
}
|
||||
|
||||
void StacksHealedOrResurrected::applyCl(CClient * cl)
|
||||
void BattleUnitsChanged::applyCl(CClient * cl)
|
||||
{
|
||||
std::vector<std::pair<ui32, ui32> > shiftedHealed;
|
||||
for(auto & elem : healedStacks)
|
||||
{
|
||||
shiftedHealed.push_back(std::make_pair(elem.stackId, (ui32)elem.delta));
|
||||
}
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleStacksHealedRes, shiftedHealed, lifeDrain, tentHealing, drainedFrom);
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleUnitsChanged, changedStacks, customEffects, battleLog);
|
||||
}
|
||||
|
||||
void ObstaclesRemoved::applyCl(CClient *cl)
|
||||
void BattleObstaclesChanged::applyCl(CClient *cl)
|
||||
{
|
||||
//inform interfaces about removed obstacles
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleObstaclesRemoved, obstacles);
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleObstaclesChanged, changes);
|
||||
}
|
||||
|
||||
void CatapultAttack::applyCl(CClient *cl)
|
||||
@@ -744,17 +718,6 @@ void CatapultAttack::applyCl(CClient *cl)
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleCatapultAttacked, *this);
|
||||
}
|
||||
|
||||
void BattleStacksRemoved::applyFirstCl(CClient * cl)
|
||||
{
|
||||
//inform interfaces about removed stacks
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleStacksRemoved, *this);
|
||||
}
|
||||
|
||||
void BattleStackAdded::applyCl(CClient *cl)
|
||||
{
|
||||
callBattleInterfaceIfPresentForBothSides(cl, &IBattleEventsReceiver::battleNewStackAppeared, GS(cl)->curB->stacks.back());
|
||||
}
|
||||
|
||||
CGameState* CPackForClient::GS(CClient *cl)
|
||||
{
|
||||
return cl->gs;
|
||||
|
||||
Reference in New Issue
Block a user