1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

real unlimited movement (like in OH3)

This commit is contained in:
Laserlicht 2023-12-09 01:37:11 +01:00 committed by GitHub
parent d612e61f0c
commit 173ee0e207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 4 deletions

View File

@ -36,7 +36,7 @@ Gives specific creature in every slot, with optional amount. Examples:
### Movement points
`nwcnebuchadnezzar` or `vcminahar` or `vcmimove` - give 1000000 movement points and free ship boarding for 1 day
`nwcnebuchadnezzar` or `vcminahar` or `vcmimove` - give unlimited (or specified amount of) movement points and free ship boarding
Alternative usage: `vcmimove <amount>` - gives specified amount of movement points
### Resources
@ -72,7 +72,7 @@ Alternative usage: `vcmiexp <amount>` - gives selected hero specified amount of
`nwcbluepill` or `vcmimelkor` or `vcmilose` - player loses
### Misc
`nwctheone` - reveals the whole map, gives 5 archangels in each empty slot, 1000000 movement points and permanent flight
`nwctheone` - reveals the whole map, gives 5 archangels in each empty slot, unlimited movement points and permanent flight
## Using cheat codes on other players
By default, all cheat codes apply to current player. Alternatively, it is possible to specify player that you want to target:

View File

@ -30,6 +30,7 @@ class JsonNode;
BONUS_NAME(SURRENDER_DISCOUNT) /*%*/ \
BONUS_NAME(STACKS_SPEED) /*additional info - percent of speed bonus applied after direct bonuses; >0 - added, <0 - subtracted to this part*/ \
BONUS_NAME(FLYING_MOVEMENT) /*value - penalty percentage*/ \
BONUS_NAME(UNLIMITED_MOVEMENT) /*cheat bonus*/ \
BONUS_NAME(SPELL_DURATION) \
BONUS_NAME(WATER_WALKING) /*value - penalty percentage*/ \
BONUS_NAME(NEGATE_ALL_NATURAL_IMMUNITIES) \

View File

@ -234,7 +234,10 @@ int CGHeroInstance::movementPointsRemaining() const
void CGHeroInstance::setMovementPoints(int points)
{
movement = std::max(0, points);
if(getBonusBearer()->hasBonusOfType(BonusType::UNLIMITED_MOVEMENT))
movement = 1000000;
else
movement = std::max(0, points);
}
int CGHeroInstance::movementPointsLimit(bool onLand) const

View File

@ -290,6 +290,7 @@ void PlayerMessageProcessor::cheatMovement(PlayerColor player, const CGHeroInsta
SetMovePoints smp;
smp.hid = hero->id;
bool unlimited = false;
try
{
smp.val = std::stol(words.at(0));;
@ -297,16 +298,27 @@ void PlayerMessageProcessor::cheatMovement(PlayerColor player, const CGHeroInsta
catch(std::logic_error&)
{
smp.val = 1000000;
unlimited = true;
}
gameHandler->sendAndApply(&smp);
GiveBonus gb(GiveBonus::ETarget::OBJECT);
gb.bonus.type = BonusType::FREE_SHIP_BOARDING;
gb.bonus.duration = BonusDuration::ONE_DAY;
gb.bonus.duration = unlimited ? BonusDuration::PERMANENT : BonusDuration::ONE_DAY;
gb.bonus.source = BonusSource::OTHER;
gb.id = hero->id;
gameHandler->giveHeroBonus(&gb);
if(unlimited)
{
GiveBonus gb(GiveBonus::ETarget::OBJECT);
gb.bonus.type = BonusType::UNLIMITED_MOVEMENT;
gb.bonus.duration = BonusDuration::PERMANENT;
gb.bonus.source = BonusSource::OTHER;
gb.id = hero->id;
gameHandler->giveHeroBonus(&gb);
}
}
void PlayerMessageProcessor::cheatResources(PlayerColor player, std::vector<std::string> words)