hasan_talib pisze:
Myślę, że to może siedzieć w kodzie źródłowym. Ale jeśli się mylę, niech Starchris mnie poprawi
Dokładnie tak jest czyli w kodzie źródłowym, a dokładnie w pliku "Soldier Control.c" w katalogu "ja2 / Build / Tactical". Linijka od 473 do 611. Poniżej jest plik, w którym są dokładnie te linijki. Do otwarcia zalecam program Notepad ++ ponieważ otworzy tekst ze wszystkimi kolorkami i upiększaczami, którego kod wdrożony w ten post nie posiada.
Załącznik:
Punkty akcji - JA2.7z [1.62 KiB]
Pobrany 137 razy
Natomiast tu jest cały kod źródłowy jak by ktoś chciał.
https://jagged-alliance.pl/plik12/
Poniżej jest główny kod, przez który oblicza się ilość punktów akcji. Jak widać główne umiejętności, które mają wpływ na punkty akcji to: doświadczenie, zwinność, życie i zręczność.
Kod:
// Calculate merc's action points at 100% capability (range is 10 - 25)
// round fractions of .5 up (that's why the +20 before the division!
ubPoints = 5 + (((10 * EffectiveExpLevel( pSold ) +
3 * EffectiveAgility( pSold ) +
2 * pSold->bLifeMax +
2 * EffectiveDexterity( pSold ) ) + 20) / 40);
//if (GameOption[INCREASEDAP] % 2 == 1)
//points += AP_INCREASE;
Zakładając, że nasz najemnik ma wszystkie statystyki po 100 punktów oraz doświadczenie na 10, to wzór wyglądałby następująco:
Punkty Akcji = 5 + { [ (10 x doświadczenie) + (3 x zwinność) + (2 x życie) + (2 x zręczność) + 20 ] / 40 } = 5 + { [ (10 x 10) + (3 x 100) + (2 x 100) + (2 x 100) + 20 ] / 40} = 25,5
Tutaj z kolei jest powyższy kod ze wszystkimi dodatkami, które odpowiadają za punkty akcji, gdy ktoś jest ranny, zmęczony, przeciążony i tak dalej.
Kod:
INT8 CalcActionPoints(SOLDIERTYPE *pSold)
{
UINT8 ubPoints,ubMaxAPs;
INT8 bBandage;
// dead guys don't get any APs (they shouldn't be here asking for them!)
if (!pSold->bLife)
return(0);
// people with sleep dart drug who have collapsed get no APs
if ( (pSold->bSleepDrugCounter > 0) && pSold->bCollapsed )
return( 0 );
// Calculate merc's action points at 100% capability (range is 10 - 25)
// round fractions of .5 up (that's why the +20 before the division!
ubPoints = 5 + (((10 * EffectiveExpLevel( pSold ) +
3 * EffectiveAgility( pSold ) +
2 * pSold->bLifeMax +
2 * EffectiveDexterity( pSold ) ) + 20) / 40);
//if (GameOption[INCREASEDAP] % 2 == 1)
//points += AP_INCREASE;
// Calculate bandage
bBandage = pSold->bLifeMax - pSold->bLife - pSold->bBleeding;
// If injured, reduce action points accordingly (by up to 2/3rds)
if (pSold->bLife < pSold->bLifeMax)
{
ubPoints -= (2 * ubPoints * (pSold->bLifeMax - pSold->bLife + (bBandage / 2))) /
(3 * pSold->bLifeMax);
}
// If tired, reduce action points accordingly (by up to 1/2)
if (pSold->bBreath < 100)
ubPoints -= (ubPoints * (100 - pSold->bBreath)) / 200;
if (pSold->sWeightCarriedAtTurnStart > 100)
{
ubPoints = (UINT8) ( ((UINT32)ubPoints) * 100 / pSold->sWeightCarriedAtTurnStart );
}
// If resulting APs are below our permitted minimum, raise them to it!
if (ubPoints < AP_MINIMUM)
ubPoints = AP_MINIMUM;
// make sure action points doesn't exceed the permitted maximum
ubMaxAPs = gubMaxActionPoints[ pSold->ubBodyType ];
//if (GameOption[INCREASEDAP] % 2 == 1)
// maxAPs += AP_INCREASE;
// If resulting APs are below our permitted minimum, raise them to it!
if (ubPoints > ubMaxAPs)
ubPoints = ubMaxAPs;
if ( pSold->ubBodyType == BLOODCAT )
{
// use same as young monsters
ubPoints = (ubPoints * AP_YOUNG_MONST_FACTOR) / 10;
}
else if (pSold->uiStatusFlags & SOLDIER_MONSTER)
{
// young monsters get extra APs
if ( pSold->ubBodyType == YAF_MONSTER || pSold->ubBodyType == YAM_MONSTER || pSold->ubBodyType == INFANT_MONSTER )
{
ubPoints = (ubPoints * AP_YOUNG_MONST_FACTOR) / 10;
}
// if frenzied, female monsters get more APs! (for young females, cumulative!)
if (pSold->bFrenzied)
{
ubPoints = (ubPoints * AP_MONST_FRENZY_FACTOR) / 10;
}
}
// adjust APs for phobia situations
if ( pSold->ubProfile != NO_PROFILE )
{
if ( (gMercProfiles[ pSold->ubProfile ].bPersonalityTrait == CLAUSTROPHOBIC) && (gbWorldSectorZ > 0) )
{
ubPoints = (ubPoints * AP_CLAUSTROPHOBE) / 10;
}
else if ( (gMercProfiles[ pSold->ubProfile ].bPersonalityTrait == FEAR_OF_INSECTS) && (MercSeesCreature( pSold ) ) )
{
ubPoints = (ubPoints * AP_AFRAID_OF_INSECTS) / 10;
}
}
// Adjusat APs due to drugs...
HandleAPEffectDueToDrugs( pSold, &ubPoints );
// If we are a vehicle, adjust APS...
if ( pSold->uiStatusFlags & SOLDIER_VEHICLE )
{
AdjustVehicleAPs( pSold, &ubPoints );
}
// if we are in boxing mode, adjust APs... THIS MUST BE LAST!
if ( gTacticalStatus.bBoxingState == BOXING || gTacticalStatus.bBoxingState == PRE_BOXING )
{
ubPoints /= 2;
}
return (ubPoints);
}
Ostatnim kodem jest kod, który oblicza punkty akcji dla walk bokserskich. MAX_AP_CARRIED to 25. Jest on dzielony przez 2, dlatego na ringu mamy maksymalnie 12 lub 13 punktów akcji.
Kod:
void CalcNewActionPoints( SOLDIERTYPE *pSoldier )
{
if ( gTacticalStatus.bBoxingState == BOXING || gTacticalStatus.bBoxingState == PRE_BOXING )
{
// if we are in boxing mode, carry 1/2 as many points
if (pSoldier->bActionPoints > MAX_AP_CARRIED / 2)
{
pSoldier->bActionPoints = MAX_AP_CARRIED / 2;
}
}
else
{
if (pSoldier->bActionPoints > MAX_AP_CARRIED)
{
pSoldier->bActionPoints = MAX_AP_CARRIED;
}
}
pSoldier->bActionPoints += CalcActionPoints( pSoldier);
// Don't max out if we are drugged....
if ( !GetDrugEffect( pSoldier, DRUG_TYPE_ADRENALINE ) )
{
pSoldier->bActionPoints = __min( pSoldier->bActionPoints, gubMaxActionPoints[ pSoldier->ubBodyType ] );
}
pSoldier->bInitialActionPoints = pSoldier->bActionPoints;
}