Initial commit
This commit is contained in:
53
engines/ultima/ultima1/spells/blink.cpp
Normal file
53
engines/ultima/ultima1/spells/blink.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/blink.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/maps/map_tile.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
Blink::Blink(Ultima1Game *game, Character *c) : Spell(game, c, SPELL_BLINK) {
|
||||
}
|
||||
|
||||
void Blink::dungeonCast(Maps::MapDungeon *map) {
|
||||
Point newPos;
|
||||
Maps::U1MapTile tile;
|
||||
|
||||
// Choose a random new location to teleport to
|
||||
do {
|
||||
newPos = Point(_game->getRandomNumber(1, 9), _game->getRandomNumber(1, 9));
|
||||
map->getTileAt(newPos, &tile);
|
||||
} while (newPos != map->getPosition() && tile._widget &&
|
||||
!tile._isBeams && !tile._isWall && !tile._isSecretDoor);
|
||||
|
||||
// And teleport there
|
||||
addInfoMsg(_game->_res->TELEPORTED);
|
||||
map->setPosition(newPos);
|
||||
_game->endOfTurn();
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
51
engines/ultima/ultima1/spells/blink.h
Normal file
51
engines/ultima/ultima1/spells/blink.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_BLINK_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_BLINK_H
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
/**
|
||||
* Blink spell
|
||||
*/
|
||||
class Blink : public Spell {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Blink(Ultima1Game *game, Character *c);
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
55
engines/ultima/ultima1/spells/create.cpp
Normal file
55
engines/ultima/ultima1/spells/create.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/create.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/maps/map_tile.h"
|
||||
#include "ultima/ultima1/maps/map_dungeon.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
Create::Create(Ultima1Game *game, Character *c) : Spell(game, c, SPELL_CREATE) {
|
||||
}
|
||||
|
||||
void Create::dungeonCast(Maps::MapDungeon *map) {
|
||||
Point newPos;
|
||||
Maps::U1MapTile tile;
|
||||
|
||||
newPos = map->getPosition() + map->getDirectionDelta();
|
||||
map->getTileAt(newPos, &tile);
|
||||
|
||||
if (tile._isHallway && !tile._widget) {
|
||||
// Create beams on the tile in front of the player
|
||||
map->setTileAt(newPos, Maps::DTILE_BEAMS);
|
||||
addInfoMsg(_game->_res->FIELD_CREATED);
|
||||
_game->endOfTurn();
|
||||
} else {
|
||||
// Failed
|
||||
Spell::dungeonCast(map);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
51
engines/ultima/ultima1/spells/create.h
Normal file
51
engines/ultima/ultima1/spells/create.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_CREATE_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_CREATE_H
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
/**
|
||||
* Create spell
|
||||
*/
|
||||
class Create : public Spell {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Create(Ultima1Game *game, Character *c);
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
55
engines/ultima/ultima1/spells/destroy.cpp
Normal file
55
engines/ultima/ultima1/spells/destroy.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/destroy.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/maps/map_tile.h"
|
||||
#include "ultima/ultima1/maps/map_dungeon.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
Destroy::Destroy(Ultima1Game *game, Character *c) : Spell(game, c, SPELL_DESTROY) {
|
||||
}
|
||||
|
||||
void Destroy::dungeonCast(Maps::MapDungeon *map) {
|
||||
Point newPos;
|
||||
Maps::U1MapTile tile;
|
||||
|
||||
newPos = map->getPosition() + map->getDirectionDelta();
|
||||
map->getTileAt(newPos, &tile);
|
||||
|
||||
if (tile._isBeams && !tile._widget) {
|
||||
// Destroy the beams in front of the player
|
||||
map->setTileAt(newPos, Maps::DTILE_HALLWAY);
|
||||
addInfoMsg(_game->_res->FIELD_DESTROYED);
|
||||
_game->endOfTurn();
|
||||
} else {
|
||||
// Failed
|
||||
Spell::dungeonCast(map);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
51
engines/ultima/ultima1/spells/destroy.h
Normal file
51
engines/ultima/ultima1/spells/destroy.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_DESTROY_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_DESTROY_H
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
/**
|
||||
* Destroy spell
|
||||
*/
|
||||
class Destroy : public Spell {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Destroy(Ultima1Game *game, Character *c);
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
115
engines/ultima/ultima1/spells/kill_magic_missile.cpp
Normal file
115
engines/ultima/ultima1/spells/kill_magic_missile.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/kill_magic_missile.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/party.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/maps/map_tile.h"
|
||||
#include "ultima/ultima1/widgets/dungeon_monster.h"
|
||||
#include "ultima/shared/maps/map_widget.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
BEGIN_MESSAGE_MAP(KillMagicMIssile, Spell)
|
||||
ON_MESSAGE(CharacterInputMsg)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
void KillMagicMIssile::cast(Maps::MapBase *map) {
|
||||
// Prompt for a direction
|
||||
addInfoMsg(": ", false);
|
||||
Shared::CInfoGetKeypress keyMsg(this);
|
||||
keyMsg.execute(_game);
|
||||
}
|
||||
|
||||
bool KillMagicMIssile::CharacterInputMsg(CCharacterInputMsg *msg) {
|
||||
Shared::Maps::Direction dir = Shared::Maps::MapWidget::directionFromKey(msg->_keyState.keycode);
|
||||
Character &c = *static_cast<Party *>(_game->_party);
|
||||
|
||||
if (dir == Shared::Maps::DIR_NONE) {
|
||||
addInfoMsg(_game->_res->NONE);
|
||||
_game->endOfTurn();
|
||||
} else {
|
||||
addInfoMsg(_game->_res->DIRECTION_NAMES[(int)dir - 1]);
|
||||
addInfoMsg(_game->_res->SPELL_PHRASES[_spellId == SPELL_MAGIC_MISSILE ? 12 : 13], false);
|
||||
//uint damage = _spellId == SPELL_MAGIC_MISSILE ?
|
||||
// c.equippedWeapon()->getMagicDamage() : 9999;
|
||||
|
||||
if (c._class == CLASS_CLERIC || _game->getRandomNumber(1, 100) < c._wisdom) {
|
||||
_game->playFX(5);
|
||||
addInfoMsg("");
|
||||
|
||||
// TODO: Non-dungeon damage
|
||||
// damage(dir, 7, 3, damage, 101, "SpellEffect");
|
||||
} else {
|
||||
addInfoMsg(_game->_res->FAILED);
|
||||
_game->playFX(6);
|
||||
_game->endOfTurn();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
Kill::Kill(Ultima1Game *game, Character *c) : KillMagicMIssile(game, c, SPELL_KILL) {
|
||||
}
|
||||
|
||||
void Kill::dungeonCast(Maps::MapDungeon *map) {
|
||||
Point newPos;
|
||||
Maps::U1MapTile tile;
|
||||
|
||||
newPos = map->getPosition() + map->getDirectionDelta();
|
||||
map->getTileAt(newPos, &tile);
|
||||
|
||||
Widgets::DungeonMonster *monster = dynamic_cast<Widgets::DungeonMonster *>(tile._widget);
|
||||
if (monster) {
|
||||
monster->attackMonster(5, 101, Widgets::ITS_OVER_9000);
|
||||
_game->endOfTurn();
|
||||
} else {
|
||||
// Failed
|
||||
KillMagicMIssile::dungeonCast(map);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
MagicMissile::MagicMissile(Ultima1Game *game, Character *c) : KillMagicMIssile(game, c, SPELL_MAGIC_MISSILE) {
|
||||
}
|
||||
|
||||
void MagicMissile::dungeonCast(Maps::MapDungeon *map) {
|
||||
Widgets::DungeonMonster *monster = map->findCreatureInCurrentDirection();
|
||||
|
||||
if (monster) {
|
||||
Character *c = *static_cast<Party *>(_game->_party);
|
||||
uint damage = c->equippedWeapon()->getMagicDamage();
|
||||
monster->attackMonster(5, 101, damage);
|
||||
} else {
|
||||
KillMagicMIssile::dungeonCast(map);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
90
engines/ultima/ultima1/spells/kill_magic_missile.h
Normal file
90
engines/ultima/ultima1/spells/kill_magic_missile.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_KILL_MAGIC_MISSILE_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_KILL_MAGIC_MISSILE_H
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
#include "ultima/shared/engine/messages.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
using Shared::CCharacterInputMsg;
|
||||
|
||||
/**
|
||||
* Common intermediate base class for both the Kill and Magic Missile spells
|
||||
*/
|
||||
class KillMagicMIssile : public Spell {
|
||||
DECLARE_MESSAGE_MAP;
|
||||
bool CharacterInputMsg(CCharacterInputMsg *msg);
|
||||
public:
|
||||
CLASSDEF;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
KillMagicMIssile(Ultima1Game *game, Character *c, SpellId spellId) : Spell(game, c, spellId) {}
|
||||
|
||||
/**
|
||||
* Cast the spell outside a dungeon
|
||||
*/
|
||||
void cast(Maps::MapBase *map) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Kill spell
|
||||
*/
|
||||
class Kill : public KillMagicMIssile {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Kill(Ultima1Game *game, Character *c);
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Magic Missile spell
|
||||
*/
|
||||
class MagicMissile : public KillMagicMIssile {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
MagicMissile(Ultima1Game *game, Character *c);
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
51
engines/ultima/ultima1/spells/ladder_down.cpp
Normal file
51
engines/ultima/ultima1/spells/ladder_down.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/ladder_down.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/maps/map_tile.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
LadderDown::LadderDown(Ultima1Game *game, Character *c) : Spell(game, c, SPELL_LADDER_DOWN) {
|
||||
}
|
||||
|
||||
void LadderDown::dungeonCast(Maps::MapDungeon *map) {
|
||||
Point pt = map->getPosition();
|
||||
Maps::U1MapTile tile;
|
||||
map->getTileAt(pt, &tile);
|
||||
|
||||
if (map->getLevel() < 10 && !tile._isBeams && ((pt.x & 1) || (pt.y & 1))) {
|
||||
map->setTileAt(pt, Maps::DTILE_LADDER_DOWN);
|
||||
addInfoMsg(_game->_res->LADDER_CREATED);
|
||||
_game->endOfTurn();
|
||||
} else {
|
||||
// Failed
|
||||
Spell::dungeonCast(map);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
51
engines/ultima/ultima1/spells/ladder_down.h
Normal file
51
engines/ultima/ultima1/spells/ladder_down.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_LADDER_DOWN_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_LADDER_DOWN_H
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
/**
|
||||
* Ladder Down spell
|
||||
*/
|
||||
class LadderDown : public Spell {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
LadderDown(Ultima1Game *game, Character *c);
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
51
engines/ultima/ultima1/spells/ladder_up.cpp
Normal file
51
engines/ultima/ultima1/spells/ladder_up.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/ladder_up.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/maps/map_tile.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
LadderUp::LadderUp(Ultima1Game *game, Character *c) : Spell(game, c, SPELL_LADDER_UP) {
|
||||
}
|
||||
|
||||
void LadderUp::dungeonCast(Maps::MapDungeon *map) {
|
||||
Point pt = map->getPosition();
|
||||
Maps::U1MapTile tile;
|
||||
map->getTileAt(pt, &tile);
|
||||
|
||||
if (!tile._isBeams && ((pt.x & 1) || (pt.y & 1))) {
|
||||
map->setTileAt(pt, Maps::DTILE_LADDER_UP);
|
||||
addInfoMsg(_game->_res->LADDER_CREATED);
|
||||
_game->endOfTurn();
|
||||
} else {
|
||||
// Failed
|
||||
Spell::dungeonCast(map);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
51
engines/ultima/ultima1/spells/ladder_up.h
Normal file
51
engines/ultima/ultima1/spells/ladder_up.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_LADDER_UP_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_LADDER_UP_H
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
/**
|
||||
* Ladder Up spell
|
||||
*/
|
||||
class LadderUp : public Spell {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
LadderUp(Ultima1Game *game, Character *c);
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
58
engines/ultima/ultima1/spells/open_unlock.cpp
Normal file
58
engines/ultima/ultima1/spells/open_unlock.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/open_unlock.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/maps/map_tile.h"
|
||||
#include "ultima/ultima1/widgets/dungeon_item.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
void OpenUnlock::dungeonCast(Maps::MapDungeon *map) {
|
||||
Maps::U1MapTile tile;
|
||||
map->getTileAt(map->getPosition(), &tile);
|
||||
|
||||
Widgets::DungeonItem *item = dynamic_cast<Widgets::DungeonItem *>(tile._widget);
|
||||
if (item) {
|
||||
addInfoMsg(item->_name, false);
|
||||
openItem(map, item);
|
||||
_game->endOfTurn();
|
||||
} else {
|
||||
Spell::dungeonCast(map);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenUnlock::openItem(Maps::MapDungeon *map, Widgets::DungeonItem *item) {
|
||||
// Say opened, and remove the coffin/chest
|
||||
map->removeWidget(item);
|
||||
addInfoMsg(Common::String::format(" %s", _game->_res->OPENED));
|
||||
addInfoMsg(_game->_res->THOU_DOST_FIND, false);
|
||||
|
||||
uint coins = _game->getRandomNumber(3, map->getLevel() * map->getLevel() + 9);
|
||||
_game->giveTreasure(coins, 0);
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
79
engines/ultima/ultima1/spells/open_unlock.h
Normal file
79
engines/ultima/ultima1/spells/open_unlock.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_OPEN_UNLOCK_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_OPEN_UNLOCK_H
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
#include "ultima/ultima1/widgets/dungeon_item.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
/**
|
||||
* Open/unlock common spell base class
|
||||
*/
|
||||
class OpenUnlock : public Spell {
|
||||
private:
|
||||
/**
|
||||
* Open a given widget
|
||||
*/
|
||||
void openItem(Maps::MapDungeon *map, Widgets::DungeonItem *item);
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
OpenUnlock(Ultima1Game *game, Character *c, SpellId spellId) : Spell(game, c, spellId) {}
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Open spell
|
||||
*/
|
||||
class Open : public OpenUnlock {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Open(Ultima1Game *game, Character *c) : OpenUnlock(game, c, SPELL_OPEN) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Open spell
|
||||
*/
|
||||
class Unlock : public OpenUnlock {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Unlock(Ultima1Game *game, Character *c) : OpenUnlock(game, c, SPELL_UNLOCK) {}
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
88
engines/ultima/ultima1/spells/prayer.cpp
Normal file
88
engines/ultima/ultima1/spells/prayer.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/prayer.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/widgets/overworld_monster.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
Prayer::Prayer(Ultima1Game *game, Character *c) : Spell(game, c, SPELL_PRAYER) {
|
||||
_quantity = 0xffff; // Prayer has unlimited uses
|
||||
}
|
||||
|
||||
void Prayer::cast(Maps::MapBase *map) {
|
||||
Shared::Character &c = *_game->_party;
|
||||
addInfoMsg("");
|
||||
addInfoMsg(_game->_res->SPELL_PHRASES[0], false);
|
||||
|
||||
bool flag = false;
|
||||
if (c._hitPoints < 15) {
|
||||
// Add hit points
|
||||
c._hitPoints = 15;
|
||||
addInfoMsg(Common::String::format(" %s", _game->_res->SPELL_PHRASES[11]));
|
||||
_game->playFX(5);
|
||||
flag = true;
|
||||
} else if (c._food < 15) {
|
||||
// Add food
|
||||
c._food = 15;
|
||||
addInfoMsg(Common::String::format(" %s", _game->_res->SPELL_PHRASES[11]));
|
||||
_game->playFX(5);
|
||||
flag = true;
|
||||
} else if (_game->getRandomNumber(1, 100) < 25) {
|
||||
for (uint idx = 0; idx < map->_widgets.size(); ++idx) {
|
||||
Widgets::OverworldMonster *monster = dynamic_cast<Widgets::OverworldMonster *>(map->_widgets[idx].get());
|
||||
if (monster && monster->attackDistance() != 0) {
|
||||
map->removeWidget(monster);
|
||||
addInfoMsg(_game->_res->MONSTER_REMOVED);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
addInfoMsg(_game->_res->NO_EFFECT);
|
||||
_game->playFX(6);
|
||||
}
|
||||
|
||||
_game->endOfTurn();
|
||||
}
|
||||
|
||||
void Prayer::dungeonCast(Maps::MapDungeon *map) {
|
||||
addInfoMsg("");
|
||||
addInfoMsg(_game->_res->SPELL_PHRASES[0]);
|
||||
|
||||
// When cast within the dungeon, cast a random spell without cost
|
||||
SpellId spellId = (SpellId)_game->getRandomNumber(SPELL_OPEN, SPELL_KILL);
|
||||
if (spellId == SPELL_STEAL)
|
||||
spellId = SPELL_LADDER_DOWN;
|
||||
|
||||
const Shared::Character &c = *_game->_party;
|
||||
static_cast<Spell *>(c._spells[spellId])->dungeonCast(map);
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
56
engines/ultima/ultima1/spells/prayer.h
Normal file
56
engines/ultima/ultima1/spells/prayer.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_PRAYER_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_PRAYER_H
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
/**
|
||||
* Prayer spell
|
||||
*/
|
||||
class Prayer : public Spell {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Prayer(Ultima1Game *game, Character *c);
|
||||
|
||||
/**
|
||||
* Cast the spell outside a dungeon
|
||||
*/
|
||||
void cast(Maps::MapBase *map) override;
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
62
engines/ultima/ultima1/spells/spell.cpp
Normal file
62
engines/ultima/ultima1/spells/spell.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/party.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
Spell::Spell(Ultima1Game *game, Character *c, SpellId spellId) : _game(game),
|
||||
_character(c), _spellId(spellId) {
|
||||
_name = _game->_res->SPELL_NAMES[spellId];
|
||||
}
|
||||
|
||||
void Spell::addInfoMsg(const Common::String &text, bool newLine, bool replaceLine) {
|
||||
Shared::CInfoMsg msg(text, newLine, replaceLine);
|
||||
msg.execute("Game");
|
||||
}
|
||||
|
||||
void Spell::cast(Maps::MapBase *map) {
|
||||
// Most spells can't be used outside of dungeons
|
||||
addInfoMsg("");
|
||||
addInfoMsg(_game->_res->DUNGEON_SPELL_ONLY);
|
||||
_game->playFX(6);
|
||||
_game->endOfTurn();
|
||||
}
|
||||
|
||||
void Spell::dungeonCast(Maps::MapDungeon *map) {
|
||||
// This is the fallback the spells call if it fails
|
||||
addInfoMsg(_game->_res->FAILED);
|
||||
_game->playFX(6);
|
||||
_game->endOfTurn();
|
||||
}
|
||||
|
||||
uint Spell::getBuyCost() const {
|
||||
return (200 - _character->_wisdom) / 32 * _spellId;
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
91
engines/ultima/ultima1/spells/spell.h
Normal file
91
engines/ultima/ultima1/spells/spell.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_SPELL_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_SPELL_H
|
||||
|
||||
#include "ultima/shared/core/party.h"
|
||||
#include "ultima/ultima1/maps/map_base.h"
|
||||
#include "ultima/ultima1/maps/map_dungeon.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
class Ultima1Game;
|
||||
class Character;
|
||||
|
||||
namespace Spells {
|
||||
|
||||
enum SpellId {
|
||||
SPELL_PRAYER = 0, SPELL_OPEN = 1, SPELL_UNLOCK = 2, SPELL_MAGIC_MISSILE = 3, SPELL_STEAL = 4,
|
||||
SPELL_LADDER_DOWN = 5, SPELL_LADDER_UP = 6, SPELL_BLINK = 7, SPELL_CREATE = 8,
|
||||
SPELL_DESTROY = 9, SPELL_KILL = 10
|
||||
};
|
||||
|
||||
/**
|
||||
* Base class for Ultima 1 spells
|
||||
*/
|
||||
class Spell : public Shared::Spell {
|
||||
protected:
|
||||
Ultima1Game *_game;
|
||||
Character *_character;
|
||||
SpellId _spellId;
|
||||
protected:
|
||||
/**
|
||||
* Adds a text string to the info area
|
||||
* @param text Text to add
|
||||
* @param newLine Whether to apply a newline at the end
|
||||
*/
|
||||
void addInfoMsg(const Common::String &text, bool newLine = true, bool replaceLine = false);
|
||||
protected:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Spell(Ultima1Game *game, Character *c, SpellId spellId);
|
||||
public:
|
||||
/**
|
||||
* Change the quantity by a given amount
|
||||
*/
|
||||
void changeQuantity(int delta) override {
|
||||
_quantity = (uint)CLIP((int)_quantity + delta, 0, 255);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cast the spell outside of dungeons
|
||||
*/
|
||||
virtual void cast(Maps::MapBase *map);
|
||||
|
||||
/**
|
||||
* Cast the spell in dungeons
|
||||
*/
|
||||
virtual void dungeonCast(Maps::MapDungeon *map);
|
||||
|
||||
/**
|
||||
* Gets how much the weapon can be bought for
|
||||
*/
|
||||
uint getBuyCost() const;
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
39
engines/ultima/ultima1/spells/steal.cpp
Normal file
39
engines/ultima/ultima1/spells/steal.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/spells/steal.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
Steal::Steal(Ultima1Game *game, Character *c) : Spell(game, c, SPELL_STEAL) {
|
||||
}
|
||||
|
||||
void Steal::dungeonCast(Maps::MapDungeon *map) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
} // End of namespace Spells
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
51
engines/ultima/ultima1/spells/steal.h
Normal file
51
engines/ultima/ultima1/spells/steal.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_U1DIALOGS_STEAL_H
|
||||
#define ULTIMA_ULTIMA1_U1DIALOGS_STEAL_H
|
||||
|
||||
#include "ultima/ultima1/spells/spell.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
namespace Spells {
|
||||
|
||||
/**
|
||||
* Steal spell
|
||||
*/
|
||||
class Steal : public Spell {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Steal(Ultima1Game *game, Character *c);
|
||||
|
||||
/**
|
||||
* Cast the spell within dungeons
|
||||
*/
|
||||
void dungeonCast(Maps::MapDungeon *map) override;
|
||||
};
|
||||
|
||||
} // End of namespace U1Dialogs
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user