1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-15 20:03:15 +02:00

Merge branch 'develop' of https://github.com/vcmi/vcmi into develop

This commit is contained in:
DjWarmonger
2016-02-02 18:48:42 +01:00
5 changed files with 165 additions and 156 deletions

View File

@@ -6,6 +6,7 @@
#include "CAdvmapInterface.h" #include "CAdvmapInterface.h"
#include "GUIClasses.h" #include "GUIClasses.h"
#include "InfoWindows.h" #include "InfoWindows.h"
#include "CCastleInterface.h"
#include "../CBitmapHandler.h" #include "../CBitmapHandler.h"
#include "../CDefHandler.h" #include "../CDefHandler.h"
@@ -622,10 +623,9 @@ void CSpellWindow::SpellArea::clickLeft(tribool down, bool previousState)
owner->myInt->showInfoDialog(std::string(msgBuf)); owner->myInt->showInfoDialog(std::string(msgBuf));
return; return;
} }
//battle spell on adv map or adventure map spell during combat => display infowindow, not cast //battle spell on adv map or adventure map spell during combat => display infowindow, not cast
if((sp->isCombatSpell() && !owner->myInt->battleInt) if((sp->isCombatSpell() && !owner->myInt->battleInt)
|| (sp->isAdventureSpell() && owner->myInt->battleInt)) || (sp->isAdventureSpell() && (owner->myInt->battleInt || owner->myInt->castleInt)))
{ {
std::vector<CComponent*> hlp(1, new CComponent(CComponent::spell, mySpell, 0)); std::vector<CComponent*> hlp(1, new CComponent(CComponent::spell, mySpell, 0));
LOCPLINT->showInfoDialog(sp->getLevelInfo(schoolLevel).description, hlp); LOCPLINT->showInfoDialog(sp->getLevelInfo(schoolLevel).description, hlp);

View File

@@ -997,7 +997,7 @@ TDmgRange CBattleInfoCallback::calculateDmgRange(const BattleAttackInfo &info) c
const bool distPenalty = !info.attackerBonuses->hasBonusOfType(Bonus::NO_DISTANCE_PENALTY) && battleHasDistancePenalty(info.attackerBonuses, info.attackerPosition, info.defenderPosition); const bool distPenalty = !info.attackerBonuses->hasBonusOfType(Bonus::NO_DISTANCE_PENALTY) && battleHasDistancePenalty(info.attackerBonuses, info.attackerPosition, info.defenderPosition);
const bool obstaclePenalty = battleHasWallPenalty(info.attackerBonuses, info.attackerPosition, info.defenderPosition); const bool obstaclePenalty = battleHasWallPenalty(info.attackerBonuses, info.attackerPosition, info.defenderPosition);
if (info.shooting) if(info.shooting)
{ {
if (distPenalty || info.defenderBonuses->hasBonus(isAdvancedAirShield)) if (distPenalty || info.defenderBonuses->hasBonus(isAdvancedAirShield))
{ {
@@ -1013,9 +1013,14 @@ TDmgRange CBattleInfoCallback::calculateDmgRange(const BattleAttackInfo &info) c
multBonus *= 0.5; multBonus *= 0.5;
} }
// psychic elementals versus mind immune units 50%
if(attackerType->idNumber == CreatureID::PSYCHIC_ELEMENTAL
&& info.defenderBonuses->hasBonusOfType(Bonus::MIND_IMMUNITY))
{
multBonus *= 0.5;
}
// TODO attack on petrified unit 50% // TODO attack on petrified unit 50%
// psychic elementals versus mind immune units 50%
// blinded unit retaliates // blinded unit retaliates
minDmg *= additiveBonus * multBonus; minDmg *= additiveBonus * multBonus;

View File

@@ -968,6 +968,7 @@ public:
WATER_ELEMENTAL = 115, WATER_ELEMENTAL = 115,
GOLD_GOLEM = 116, GOLD_GOLEM = 116,
DIAMOND_GOLEM = 117, DIAMOND_GOLEM = 117,
PSYCHIC_ELEMENTAL = 120,
CATAPULT = 145, CATAPULT = 145,
BALLISTA = 146, BALLISTA = 146,
FIRST_AID_TENT = 147, FIRST_AID_TENT = 147,
@@ -1053,7 +1054,3 @@ typedef int TRmgTemplateZoneId;
#undef ID_LIKE_OPERATORS_INTERNAL #undef ID_LIKE_OPERATORS_INTERNAL
#undef INSTID_LIKE_CLASS_COMMON #undef INSTID_LIKE_CLASS_COMMON
#undef OP_DECL_INT #undef OP_DECL_INT

View File

@@ -140,10 +140,12 @@ static bool ruleIsSomething(const std::string & rule)
return rule == "+"; return rule == "+";
} }
#ifndef NDEBUG
static bool ruleIsAny(const std::string & rule) static bool ruleIsAny(const std::string & rule)
{ {
return rule == "?"; return rule == "?";
} }
#endif
///CDrawRoadsOperation ///CDrawRoadsOperation
CDrawRoadsOperation::CDrawRoadsOperation(CMap * map, const CTerrainSelection & terrainSel, ERoadType::ERoadType roadType, CRandomGenerator * gen): CDrawRoadsOperation::CDrawRoadsOperation(CMap * map, const CTerrainSelection & terrainSel, ERoadType::ERoadType roadType, CRandomGenerator * gen):
@@ -351,4 +353,3 @@ CDrawRoadsOperation::ValidationResult CDrawRoadsOperation::validateTile(const Ro
return result; return result;
} }

View File

@@ -154,6 +154,13 @@ bool DefaultSpellMechanics::adventureCast(const SpellCastEnvironment * env, Adve
} }
const CGHeroInstance * caster = parameters.caster; const CGHeroInstance * caster = parameters.caster;
if(caster->inTownGarrison)
{
env->complain("Attempt to cast an adventure spell in town garrison");
return false;
}
const int cost = caster->getSpellCost(owner); const int cost = caster->getSpellCost(owner);
if(!caster->canCastThisSpell(owner)) if(!caster->canCastThisSpell(owner))
@@ -857,4 +864,3 @@ void DefaultSpellMechanics::prepareBattleCast(const BattleSpellCastParameters& p
sc.casterStack = (parameters.casterStack ? parameters.casterStack->ID : -1); sc.casterStack = (parameters.casterStack ? parameters.casterStack->ID : -1);
sc.manaGained = 0; sc.manaGained = 0;
} }