Skip to content

Commit

Permalink
Merge pull request #160 from ChilliHugger/feature/159-difficulty-effe…
Browse files Browse the repository at this point in the history
…cts-time-of-recruiting

#159 Effect of difficulty on recruitment
IcemarkUK authored Mar 29, 2023
2 parents 2811b5a + 353a81b commit ad26a8a
Showing 5 changed files with 148 additions and 166 deletions.
6 changes: 5 additions & 1 deletion main/midnight/src/tme/baseinc/info.h
Original file line number Diff line number Diff line change
@@ -520,6 +520,8 @@ inline chilli::lib::archive& operator>>( chilli::lib::archive& ar, mxunit& unit
public:
DEFAULT_IMPLEMENTATION(mxcommand);

s32 SuccessTime() const ;

public:
s32 successtime;
s32 failuretime;
@@ -1002,6 +1004,7 @@ typedef chilli::collections::base<mxarmy*> c_army ;

void SetLastCommand ( command_t cmd, mxid id );
void CommandTakesTime ( bool success );
s32 CommandSuccessTime( command_t cmd );

// Commands
virtual MXRESULT Cmd_LookLeft ( void );
@@ -1039,7 +1042,8 @@ typedef chilli::collections::base<mxarmy*> c_army ;
virtual bool CanFollow( const mxcharacter* c ) const ;
virtual bool CheckFightObject ( mxobject* object ) const;
virtual bool CheckRecruitChar ( mxcharacter* pChar ) const ;
virtual bool Recruited ( mxcharacter* character );
virtual bool Recruited ( mxcharacter* recruiter );
virtual void SetRecruitmentTime( mxcharacter* recruiter );
virtual void LostFight ( void );
virtual void Displace ( void );
virtual void DecreaseEnergy ( s32 amount );
172 changes: 84 additions & 88 deletions main/midnight/src/tme/baseinc/scenario.h
Original file line number Diff line number Diff line change
@@ -8,25 +8,24 @@ namespace tme {
//class mxengine;

typedef struct scenarioinfo_t {
u32 Id;
u32 Version;
LPCSTR Title;
LPCSTR Author;
LPCSTR AuthorEmail;
LPCSTR AuthorUrl;
LPCSTR Description;
LPCSTR Copyright;
u32 Id;
u32 Version;
LPCSTR Title;
LPCSTR Author;
LPCSTR AuthorEmail;
LPCSTR AuthorUrl;
LPCSTR Description;
LPCSTR Copyright;
} scenarioinfo_t ;


// default engine scenario
// features
enum FEATURES {
SF_MOONRING = MXBIT(0),
SF_ICEFEAR = MXBIT(1),
SF_APPROACH_DDR = MXBIT(2),
SF_RECRUIT_DDR = MXBIT(3),
SF_RECRUIT_TIME = MXBIT(4),
SF_MOONRING = MXBIT(0),
SF_ICEFEAR = MXBIT(1),
SF_APPROACH_DDR = MXBIT(2),
SF_RECRUIT_DDR = MXBIT(3),
SF_RECRUIT_TIME = MXBIT(4),
SF_TUNNELS = MXBIT(5),
SF_MIST = MXBIT(6),
};
@@ -39,9 +38,6 @@ namespace tme {
virtual MXRESULT Command ( const std::string& arg, variant argv[], u32 argc )=0;
virtual MXRESULT GetProperties ( const std::string& arg, variant argv[], u32 argc )=0;
virtual MXRESULT Text ( const std::string& command, variant* argv=NULL, u32 args=0 )=0;

//virtual MXRESULT Register ( mxengine* midnightx ) =0;
//virtual MXRESULT UnRegister ( mxengine* midnightx )=0;
};


@@ -53,26 +49,26 @@ namespace tme {

typedef struct character_t : public mxitem_t {

std::string longname;
std::string shortname;
std::string longname;
std::string shortname;

flags32 traits;
flags32 traits;

mxrace_t race;
mxgender_t gender;
mxdir_t looking;
mxgender_t gender;
mxdir_t looking;
mxtime_t time;
mxrace_t loyalty;

battle_t battle;
recruitment_t recruit;
recruitment_t recruit;

u32 reckless;
u32 energy;
u32 strength;
u32 cowardess;
u32 courage;
u32 fear;
u32 reckless;
u32 energy;
u32 strength;
u32 cowardess;
u32 courage;
u32 fear;

mxid foe;
mxid liege;
@@ -97,14 +93,14 @@ namespace tme {
} routenode_t ;

typedef struct regiment_t : public mxitem_t {
mxrace_t race;
mxrace_t race;
mxunit_t type;
u32 total;
u32 total;
mxid target;
loc_t targetlocation;
mxorders_t orders;
u32 success;
u32 killed;
loc_t targetlocation;
mxorders_t orders;
u32 success;
u32 killed;
mxid loyalty;
loc_t lastlocation;
} regiment_t ;
@@ -113,26 +109,26 @@ namespace tme {
mxrace_t occupyingrace;
mxrace_t race;
mxunit_t type;
u32 totaltroops;
u32 mintroops;
u32 maxtroops;
u32 strategical_success;
u32 owner_success;
u32 enemy_success;
u32 influence;
u32 respawn;
u32 totaltroops;
u32 mintroops;
u32 maxtroops;
u32 strategical_success;
u32 owner_success;
u32 enemy_success;
u32 influence;
u32 respawn;
mxid occupier;
mxid owner;
mxterrain_t terrain;
u32 killed;
mxterrain_t terrain;
u32 killed;
mxrace_t loyalty;
} stronghold_t ;

typedef struct place_t : public mxitem_t {
} place_t ;

typedef struct memoryitem_t : public mxitem_t {
u32 day;
u32 day;
mxid data;
mxrace_t race;
} memoryitem_t ;
@@ -141,50 +137,50 @@ namespace tme {
// infos
//
typedef struct areainfo_t : public mxinfo_t {
std::string prefix;
std::string prefix;
} areainfo_t ;

typedef struct directioninfo_t : public mxinfo_t {
mxdir_t type;
mxdir_t type;
} directioninfo_t ;

typedef struct genderinfo_t : public mxinfo_t {
mxgender_t type;
std::string pronoun[3];
mxgender_t type;
std::string pronoun[3];
} genderinfo_t ;

typedef struct object_t : public mxitem_t {
mxthing_t kills;
std::string name;
std::string description;
mxthing_t kills;
std::string name;
std::string description;
mxid usedescription;
mxid carriedby;
} object_t ;

typedef struct raceinfo_t : public mxinfo_t {
mxrace_t type;
std::string soldiersname;
u32 success;
u32 initialmovement;
s32 diagonalmodifier;
s32 ridingmultiplier;
u32 movementmax;
u32 baserestamount;
u32 strongholdstartups;
s32 misttimeaffect ;
s32 mistdespondecyaffect ;
s32 baseenergycost ;
s32 baseenergycosthorse ;
mxrace_t type;
std::string soldiersname;
u32 success;
u32 initialmovement;
s32 diagonalmodifier;
s32 ridingmultiplier;
u32 movementmax;
u32 baserestamount;
u32 strongholdstartups;
s32 misttimeaffect ;
s32 mistdespondecyaffect ;
s32 baseenergycost ;
s32 baseenergycosthorse ;
} raceinfo_t ;

typedef struct terraininfo_t : public mxinfo_t {
mxterrain_t type;
std::string preposition;
std::string description;
u32 success;
u32 visibility;
u32 obstruction;
s32 movementcost;
mxterrain_t type;
std::string preposition;
std::string description;
u32 success;
u32 visibility;
u32 obstruction;
s32 movementcost;
} terraininfo_t ;

typedef struct unitinfo_t : public mxinfo_t {
@@ -194,20 +190,20 @@ namespace tme {
} unitinfo_t ;

typedef struct commandinfo_t : public mxinfo_t {
command_t type;
s32 successtime;
s32 failuretime;
command_t type;
s32 successtime;
s32 failuretime;
} commandinfo_t ;

//
// other
//

typedef struct armytotal_t {
u32 warriors ;
u32 riders ;
u32 armies ;
u32 adjustment ;
u32 warriors ;
u32 riders ;
u32 armies ;
u32 adjustment ;
mxid character;
} armytotal_t ;

@@ -216,21 +212,21 @@ namespace tme {
mxarmytype_t type; // this is probably redundant, contained within parent?
mxunit_t unit;
mxrace_t race;
u32 total;
u32 energy;
u32 lost;
u32 killed;
u32 total;
u32 energy;
u32 lost;
u32 killed;
} army_t ;

typedef struct location_t : public mxitem_t {
mxterrain_t terrain;
mxterrain_t terrain;
mxid object;
mxid object_tunnel;
mxid area;
u8 climate;
u8 density;
u8 climate;
u8 density;
u8 tunnel;
flags32 discovery_flags;
flags32 discovery_flags;
} location_t ;
} // namespace export ;
} // namespace scenarios
5 changes: 5 additions & 0 deletions main/midnight/src/tme/scenario/info_command.cpp
Original file line number Diff line number Diff line change
@@ -56,6 +56,11 @@ namespace tme {
return mxinfo::FillExportData ( data );
}

s32 mxcommand::SuccessTime() const
{
return successtime;
}


}
// namespace tme
Loading

0 comments on commit ad26a8a

Please sign in to comment.