void Fantom_AddFantomCharacter(string sGroupName, int iShipType, string sFantomType, int iEncounterType, int iNation) // NK 04-09-05 add nation argument
{
ref rFantom = GetFantomCharacter(iNumFantoms);
ClearCharacter(rFantom); // PB: Clear ALL attributes from previous character
rFantom.nation = iNation; // NK
// DeleteAttribute(rFantom, "relation"); // PB: Character already cleared
rFantom.SeaAI.Group.Name = sGroupName;
rFantom.Ship.Type = GetShipID(iShipType); // PS
//trace("added fantom " + rFantom.index + " with ship " + rFantom.ship.type);
rFantom.Ship.idx = iShipType; // PS
rFantom.Ship.Mode = sFantomType;
rFantom.ship.cannons.Charge.Type = GOOD_BALLS;
//NK -->
// DeleteAttribute(rFantom,"ship.cannons.borts"); rFantom.ship.cannons.borts = ""; // NK 05-04-18 cannon qty // PB: Character already cleared
// PRS3 -->
aref arship; makearef(arship, rFantom.ship);
// DeleteAttribute(rFantom, "ship.stats"); // PB: Character already cleared
//KB - Tuning ships - changed call to SetRandomStatsToShip
SetRandomStatsToShip(sti(rFantom.index), iShipType, iNation);
//KB - orig SetRandomStatsToShip(arship, iShipType, iNation);
//KB
// PRS3 <--
if(sti(rFantom.nation) == PIRATE) { sFantomType = "pirate"; }
else { if(sFantomType == "pirate") { sFantomType = "war"; } }
rFantom.shiptype = GetShipID(iShipType); // PS
rFantom.FantomType = sFantomType;
float mult = 1.0;
if(DEBUG_EXPERIENCE>0) TraceAndLog("Fantom_AddFantomCharacter: Set officer type for " + GetMySimpleName(rFantom));
switch(sFantomType)
{
case "trade":
mult *= 1.0;
rFantom.quest.officertype = OFFIC_TYPE_CAPMERCHANT;
break;
case "war":
mult *= 1.25;
rFantom.quest.officertype = OFFIC_TYPE_CAPNAVY;
break;
case "pirate":
mult *= 1.25;
rFantom.quest.officertype = OFFIC_TYPE_CAPPIRATE;
break;
case "error":
mult *= 1.0;
rFantom.quest.officertype = OFFIC_TYPE_CAPPIRATE;
break;
}
ref Shiptype = GetShipByType(iShipType);
int iMCShipClass = makeint(GetCharacterShipClass(GetMainCharacter()));
if (sti(Shiptype.Class) < iMCShipClass) {
mult *= 1.15;
} else {
if (makeint(Shiptype.Class) > iMCShipClass) mult *= 0.85;
}
rFantom.Points = mult * stf(GetLocalShipAttrib(&arship,&Shiptype,"Weight")) / 5000; // PRS3
//Log_SetStringToLog("Type: " + rFantom.FantomType + "; Mult: " + rFantom.Points);
// NK <--
InitCharacterSkills(rFantom); // PB: Reset this character
SetBaseShipData(rFantom); // PB: ADDED TO AVOID EXTRA ERRORS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
iNumFantoms++;
}