1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* minor changes

This commit is contained in:
mateuszb 2009-07-31 11:20:53 +00:00
parent 8e63c73cf8
commit 586957b749
4 changed files with 17 additions and 62 deletions

View File

@ -1717,12 +1717,13 @@ void CPlayerInterface::objectPropertyChanged(const SetObjectProperty * sop)
//redraw minimap if owner changed
if(sop->what == 1)
{
LOCPLINT->adventureInt->minimap.initFlaggableObjs();
const CGObjectInstance * obj = LOCPLINT->cb->getObjectInfo(sop->id);
adventureInt->minimap.initFlaggableObjs();
const CGObjectInstance * obj = cb->getObjectInfo(sop->id);
std::set<int3> pos = obj->getBlockedPos();
for(std::set<int3>::const_iterator it = pos.begin(); it != pos.end(); ++it)
{
LOCPLINT->adventureInt->minimap.showTile(*it);
if(cb->isVisible(*it))
adventureInt->minimap.showTile(*it);
}
}

View File

@ -285,7 +285,7 @@ void SetObjectProperty::applyCl( CClient *cl )
//inform all players that see this object
for(std::map<ui8,CGameInterface *>::const_iterator it = cl->playerint.begin(); it != cl->playerint.end(); ++it)
{
//if(cl->gs->isVisible(cl->gs->map->objects[id]), it->first)
if(GS(cl)->isVisible(GS(cl)->map->objects[id], it->first))
INTERFACE_CALL_IF_PRESENT(it->first, objectPropertyChanged, this);
}
}

View File

@ -1756,11 +1756,15 @@ bool CGameState::getPath(int3 src, int3 dest, const CGHeroInstance * hero, CPath
bool CGameState::isVisible(int3 pos, int player)
{
if(player == 255) //neutral player
return false;
return players[player].fogOfWarMap[pos.x][pos.y][pos.z];
}
bool CGameState::isVisible( const CGObjectInstance *obj, int player )
{
if(player == 255) //neutral player
return false;
//object is visible when at least one blocked tile is visible
for(int fx=0; fx<8; ++fx)
{

View File

@ -17,6 +17,7 @@
#include <boost/foreach.hpp>
#include <boost/thread.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/assign/list_of.hpp>
#include <fstream>
/*
@ -2494,64 +2495,13 @@ void CGameHandler::playerMessage( ui8 player, const std::string &message )
static ui32 calculateSpellDmg(const CSpell * sp, const CGHeroInstance * caster, const CStack * affectedCreature)
{
ui32 ret = 0; //value to return
switch(sp->id)
{
case 15: //magic arrow
{
ret = caster->getPrimSkillLevel(2) * 10 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 16: //ice bolt
{
ret = caster->getPrimSkillLevel(2) * 20 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 17: //lightning bolt
{
ret = caster->getPrimSkillLevel(2) * 25 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 18: //implosion
{
ret = caster->getPrimSkillLevel(2) * 75 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 20: //frost ring
{
ret = caster->getPrimSkillLevel(2) * 10 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 21: //fireball
{
ret = caster->getPrimSkillLevel(2) * 10 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 22: //inferno
{
ret = caster->getPrimSkillLevel(2) * 10 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 23: //meteor shower
{
ret = caster->getPrimSkillLevel(2) * 10 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 24: //death ripple
{
ret = caster->getPrimSkillLevel(2) * 5 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 25: //destroy undead
{
ret = caster->getPrimSkillLevel(2) * 10 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
case 26: //armageddon
{
ret = caster->getPrimSkillLevel(2) * 50 + sp->powers[caster->getSpellSchoolLevel(sp)];
break;
}
}
//15 - magic arrows, 16 - ice bolt, 17 - lightning bolt, 18 - implosion, 20 - frost ring, 21 - fireball, 22 - inferno, 23 - meteor shower,
//24 - death ripple, 25 - destroy undead, 26 - armageddon
std::map <int, int> dmgMultipliers = boost::assign::map_list_of(15, 10)(16, 20)(17, 25)(18, 75)(20, 10)(21, 10)(22, 10)(23, 10)(24, 5)(25, 10)(26, 50);
ret = caster->getPrimSkillLevel(2) * dmgMultipliers[sp->id] + sp->powers[caster->getSpellSchoolLevel(sp)];
//applying sorcerery secondary skill
switch(caster->getSecSkillLevel(25))
{