Skip to content

Instantly share code, notes, and snippets.

@esterTion
Created January 18, 2019 16:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esterTion/b44a7659eb7b482bb81e750e2a4a00d9 to your computer and use it in GitHub Desktop.
Save esterTion/b44a7659eb7b482bb81e750e2a4a00d9 to your computer and use it in GitHub Desktop.
pseudo code of hp algorithm in Arcaea
ScoreState::init() {
if (skillType == 2) {
this->hp = 100.0;
} else if (this->characterAbility != NULL) {
this->hp = this->characterAbility->hpStart;
} else {
this->hp = 0.0;
}
if (noteCount < 1) {
calcHp = 0.0;
} else {
if (noteCount < 400) {
baseHp = 200.0;
additionHp = noteCount * 0.5;
} else if (noteCount < 600) {
baseHp = 280.0;
additionHp = (noteCount - 400) * 0.5;
} else {
baseHp = 360.0;
additionHp = (noteCount - 600) / 5.0;
}
calcHp = baseHp + additionHp;
}
adjustedHp = calcHp / 2.5;
if (chartLevel == 11) // Lv10 chart
adjustedHp *= 0.8;
this->hpRegenCoeff = adjustedHp / noteCount;
}
enum HitAccuracyType {
accPure;
inaccPure;
far;
};
enum LateEarlyType {
late = 1;
early;
}
ScoreState::hitNote(ScoreState *this, LogicNote *note, HitAccuracyType hitAccuracyType, LateEarlyType lateEarlyType, int unknown) {
hpRegenCoeff = this->hpRegenCoeff;
if (this->characterAbility != NULL) {
// e.g Eto&Luna has 0.7, other has 1.0
skillCoeff = this->characterAbility->getHpRegenCoeff();
hpRegenCoeff *= skillCoeff;
}
if (hitAccuracyType == 2) { // far
this->farCount++;
updatedHp = hpRegenCoeff * 0.5 + this->hp;
if (updatedHp > 100.0) updatedHp = 100.0;
this->hp = updatedHp;
if (lateEarlyType == 1) {
this->lateFarCount++;
} else if (lateEarlyType == 2) {
this->earlyFarCount++;
}
} else { // pure
this->pureCount++;
updatedHp = hpRegenCoeff+ this->hp;
if (updatedHp > 100.0) updatedHp = 100.0;
if (hitAccuracyType == 1) {
if (lateEarlyType == 1) {
this->latePureCount++;
} else if (lateEarlyType == 2) {
this->earlyPureCount++;
}
}
}
// score calculation
}
ScoreState::missNote(ScoreState *this, LogicNote *note, int unknown) {
damageBase = 0.6;
if (skillType == 1) {
damageBase = 1.0;
}
if (skillType == 2) { // hard
damageBase = 2.5;
if (this->hp > 30)
damageBase = 4.5;
} else if (skillType == 5) { // Fractire Hikari
if (this->hadReachedFullHp) {
damageBase = 0.6;
} else {
damageBase = 2.5;
if (this->hp > 30)
damageBase = 4.5;
}
}
currentHp = this->hp;
updatedHp = currentHp;
if (note->noteType == "LogicLongNoteBase") { // unknown meaning
updatedHp -= damageBase;
} else {
updatedHp -= damageBase * 2.0;
}
if (updatedHp < 0.0) updatedHp = 0.0;
if (this->skillType == 2 && updatedHp < 30.0 && currentHp > 30.0) {
// hard hp decrease from above 30 to below 30, decrease damage
updatedHp += (currentHp - 30.0) * 0.5;
}
this->hp = updatedHp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment