Skip to content

Commit

Permalink
Allow men who are mounts (ie, centaurs) to use riding skill in battle
Browse files Browse the repository at this point in the history
  • Loading branch information
sgb committed Aug 2, 2019
1 parent c290a59 commit b61a944
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Changes from 5.1.0 -> 5.2.0
--------------------------------------------------
Bug fixes:
-- Stored original development value for hexes in the save file to
allow pillaged regions to know what value to recover to


Changes from 5.0.0 -> 5.1.0
--------------------------------------------------
Game Changes:
Expand Down Expand Up @@ -70,7 +77,7 @@ Changes from 5.0.0 -> 5.1.0
SKILL_LIMIT_NONLEADERS and MAGE_NONLEADERS are both set
-- Stopped riding capacity from helping in the ocean
-- Made OPTION TEMPLATE OFF actually turn off templates completely
-- Corrected that region half of the shafts generated thought they were in
-- Corrected what region half of the shafts generated thought they were in
-- Made the atlantis executable return appropriate result codes, instead
of always claiming success
-- Fixed some crash situations
Expand Down
34 changes: 24 additions & 10 deletions army.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,31 @@ Soldier::Soldier(Unit * u,Object * o,int regtype,int r,int ass)
// Mounts of some type _are_ allowed in this region
//
int mountType;
for (mountType = 1; mountType < NUMMOUNTS; mountType++) {
abbr = MountDefs[mountType].abbr;
if (ItemDefs[race].type & IT_MOUNT) {
// If the man is a mount (Centaurs), then the only option
// they have for riding is the built-in one
abbr = ItemDefs[race].abr;
item = unit->GetMount(abbr, canFly, canRide, ridingBonus);
if (item == -1) continue;
// Defer adding the combat bonus until we know if the weapon
// allows it. The defense bonus for riding can be added now
// however.
dskill[ATTACK_RIDING] += ridingBonus;
riding = item;
break;
} else {
for (mountType = 1; mountType < NUMMOUNTS; mountType++) {
abbr = MountDefs[mountType].abbr;
// See if this mount is an option
item = unit->GetMount(abbr, canFly, canRide, ridingBonus);
if (item == -1) continue;
// No riding other men in combat
if (ItemDefs[item].type & IT_MAN) {
item = -1;
ridingBonus = 0;
continue;
}
break;
}
}
// Defer adding the combat bonus until we know if the weapon
// allows it. The defense bonus for riding can be added now
// however.
dskill[ATTACK_RIDING] += ridingBonus;
riding = item;
}

//
Expand Down Expand Up @@ -458,7 +472,7 @@ void Soldier::RestoreItems()
unit->items.SetNum(weapon,unit->items.GetNum(weapon) + 1);
if (armor != -1)
unit->items.SetNum(armor,unit->items.GetNum(armor) + 1);
if (riding != -1)
if (riding != -1 && !(ItemDefs[riding].type & IT_MAN))
unit->items.SetNum(riding,unit->items.GetNum(riding) + 1);

int battleType;
Expand Down
6 changes: 4 additions & 2 deletions unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2244,8 +2244,10 @@ int Unit::GetMount(AString &itm, int canFly, int canRide, int &bonus)
Practice(sk);
}

// Get the mount
items.SetNum(item, num - 1);
// Remove the mount from the unit to attach it to the soldier
// UNLESS it IS the soldier (looking at you, Centaurs)
if (!(ItemDefs[item].type & IT_MAN))
items.SetNum(item, num - 1);
return item;
}

Expand Down

0 comments on commit b61a944

Please sign in to comment.