Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions Assets/Scripts/Scriptable Objects/EnemiesAI/CerberusHead.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ public class CerberusHead : Enemy, ICompositeUnit {
// O nível do cérbero deve ser incrementado de 1 em 1 para versões mais fortes
// O nível das habilidades do cérbero devem ser incrementadas de 3 em 3 para cada versão
private const int maxHeads = 3;
private const float hellfireChance = 0.9f;
public static int heads = 0;
private static int hellFireCD = 0;
private static bool summonedGhosts;
private static int tremendousRoarCD = 0;
private static bool summonedGhosts = false;
private static BattleUnit backHead = null;
private static BattleUnit middleHead = null;
private static BattleUnit frontHead = null;
Expand Down Expand Up @@ -171,6 +173,7 @@ public override Sprite GetSubUnitPortrait(int index) {

public override void ResetParameters() {
hellFireCD = 0;
tremendousRoarCD = 0;
summonedGhosts = false;
}

Expand All @@ -184,7 +187,8 @@ protected override Skill SkillDecision(float percentageNotDefense) {
float roll = Random.Range(0.0f, 1.0f);
float percentageDebuff = Mathf.Min(1f, percentageNotDefense) / 3f;

if (!AllHeroesAreParalised() && roll < percentageDebuff) {
if (!AllHeroesAreParalised() && RollRoarOffCooldown(roll, percentageDebuff)) {
tremendousRoarCD = heads;
TremendousRoalSkill.Level = SkillLevel;
return TremendousRoalSkill;
}
Expand All @@ -193,20 +197,29 @@ protected override Skill SkillDecision(float percentageNotDefense) {
return defenseSkill;
}

private bool RollRoarOffCooldown(float roll, float roarChance) {
if (tremendousRoarCD > 0) {
tremendousRoarCD--;
return false;
}
return roll < roarChance;
}

public override Skill AttackDecision() {
if (hellFireCD < 1)
return RollHellfireAttack();
hellFireCD--;
return attackSkill;
return RollHellfireOffCooldown() ? HellfireSkill : attackSkill;
}

private Skill RollHellfireAttack() {
private bool RollHellfireOffCooldown() {
if (hellFireCD > 0) {
hellFireCD--;
return false;
}
float roll = Random.Range(0.0f, 1.0f);
if (roll >= 0.9f / heads)
return attackSkill;
hellFireCD = (heads - 1);
if (roll >= hellfireChance / heads)
return false;
hellFireCD = heads;
HellfireSkill.Level = SkillLevel;
return HellfireSkill;
return true;
}

protected override List<BattleUnit> GetTargets(TargetType type) {
Expand Down