diff --git a/src/main/webapp/app/entities/army/army-detail-desktop.component.html b/src/main/webapp/app/entities/army/army-detail-desktop.component.html index de2446f1..d37ccd32 100644 --- a/src/main/webapp/app/entities/army/army-detail-desktop.component.html +++ b/src/main/webapp/app/entities/army/army-detail-desktop.component.html @@ -76,6 +76,9 @@
Unit {{rowIndex + 1}}: {{ unit.unitName }} +
+ This unit has ranked up +
{{ unit.rank }} diff --git a/src/main/webapp/app/entities/army/army-detail-mobile.html b/src/main/webapp/app/entities/army/army-detail-mobile.html index 973accc2..5b6d115f 100644 --- a/src/main/webapp/app/entities/army/army-detail-mobile.html +++ b/src/main/webapp/app/entities/army/army-detail-mobile.html @@ -9,6 +9,10 @@
Force:
{{ getForcePoints() }}
+
+
CP:
+
{{ getForceCP() }}
+
@@ -62,6 +66,11 @@ >BTN +
+
+
This unit has ranked up
+
+
Battle Honours
diff --git a/src/main/webapp/app/entities/army/army-detail.component.ts b/src/main/webapp/app/entities/army/army-detail.component.ts index a272be0f..8d125994 100644 --- a/src/main/webapp/app/entities/army/army-detail.component.ts +++ b/src/main/webapp/app/entities/army/army-detail.component.ts @@ -17,6 +17,7 @@ export class ArmyDetailComponent implements OnInit { army: IArmy | null = null; units: IArmy['units'] | null = null; private forcePoints: number; + private forceCrusadePoints: number; @LocalStorage('forceAddedListStored') public forceUnitList: ForceUnit[]; private responsiveService: ResponsiveService = new ResponsiveService(); @@ -25,6 +26,7 @@ export class ArmyDetailComponent implements OnInit { constructor(protected dataUtils: JhiDataUtils, protected activatedRoute: ActivatedRoute) { this.forcePoints = 0; + this.forceCrusadePoints = 0; const localStorageList = localStorage.getItem('forceAddedListStored'); this.forceUnitList = localStorageList ? JSON.parse(localStorageList) : []; // localStorage.setItem('armyStored', JSON.stringify(this.army)); @@ -79,9 +81,11 @@ export class ArmyDetailComponent implements OnInit { addForceUnit(unit: UnitArmy): number { if (unit && unit.id && unit.unitPowerLevel && !this.forceAddedOrNot(unit.id)) { this.forcePoints = this.forcePoints + unit.unitPowerLevel; - // if (this.army) { - // unit.army = this.army; - // } + if (unit.crusadePointsUnit) { + console.log(this.forceCrusadePoints + " " + unit.crusadePointsUnit) + this.forceCrusadePoints = this.forceCrusadePoints + unit.crusadePointsUnit; + console.log(this.forceCrusadePoints + " " + unit.crusadePointsUnit) + } const fu = new ForceUnit( unit, 0, 0, 0, 0, 1, false, false ) @@ -96,9 +100,45 @@ export class ArmyDetailComponent implements OnInit { return this.forcePoints; } + getForceCP(): number { + return this.forceCrusadePoints; + } + + needsUpdate(unit: UnitArmy): boolean { + let _rank: string; + if (unit && unit.experiencePoints && unit.rank) { + if (unit.experiencePoints > 0 && unit.experiencePoints <= 5) { + _rank = "Battle-Ready"; + } + else if (unit.experiencePoints > 5 && unit.experiencePoints <= 15) { + _rank = "Bloodied"; + } + else if (unit.experiencePoints > 16 && unit.experiencePoints <= 30) { + _rank = "Battle-Hardened"; + } + else if (unit.experiencePoints > 30 && unit.experiencePoints <= 50) { + _rank = "Heroic"; + } + else if (unit.experiencePoints > 50) { + _rank = "Legendary"; + } + else { + _rank = "Unknown"; + } + + if (_rank !== unit.rank) { + return true + } + } + return false + } + removeForceUnit(unit: UnitArmy): number { if (unit && unit.id && unit.unitPowerLevel && this.forceAddedOrNot(unit.id)) { this.forcePoints = this.forcePoints - unit.unitPowerLevel; + if (unit.crusadePointsUnit) { + this.forceCrusadePoints = this.forceCrusadePoints - unit.crusadePointsUnit; + } const index = this.getForceUnitIndex(unit); if (index !== null) { this.forceUnitList.splice(index, 1); @@ -134,6 +174,7 @@ export class ArmyDetailComponent implements OnInit { clearForce(): void { this.forceUnitList = []; this.forcePoints = 0; + this.forceCrusadePoints = 0; localStorage.setItem('forceAddedListStored', JSON.stringify(this.forceUnitList)); } }