This commit is contained in:
Chris Chen 2025-11-14 07:28:22 -08:00
parent 0d3995764b
commit ee6dc58a21
4 changed files with 63 additions and 17 deletions

View File

@ -26,6 +26,7 @@ export interface MD2MobInfo {
minionImgUrl: string; minionImgUrl: string;
mobLevelInfos: MD2MobLevelInfo[]; mobLevelInfos: MD2MobLevelInfo[];
skills: MD2MobSkill[]; skills: MD2MobSkill[];
bossFightProfile?: BossFightProfile;
} }
export interface MD2MobLevelInfo { export interface MD2MobLevelInfo {
@ -68,3 +69,29 @@ export interface MD2DiceSet {
green: number | null; green: number | null;
black: number | null; black: number | null;
} }
export interface BossFightProfile {
mobInfoId: string;
id: string;
prerequisite: string;
objective: string;
specialRules: string;
extraTokenName: string;
extraTokenHtml: string;
extraTokenName2: string;
extraTokenHtml2: string;
phaseBuffs: BossFightPhaseBuff[];
}
export interface BossFightPhaseBuff {
id: string;
bossFightProfileId: string;
phase: number;
extraAction: number;
extraAttackDice: MD2DiceSet;
extraDefenceDice: MD2DiceSet;
extraHp: number;
extraTokenCount: number;
extraTokenCount2: number;
enableExtraBuffDescription: boolean;
extraBuffDescription: string;
}

View File

@ -32,8 +32,8 @@
// HP and Mana Bars Overlay // HP and Mana Bars Overlay
.hero-stats-overlay { .hero-stats-overlay {
position: absolute; position: relative;
bottom: 0; bottom: 60px;
left: 0; left: 0;
right: 0; right: 0;
padding: 0.5rem; padding: 0.5rem;
@ -41,9 +41,6 @@
border-radius: 0 0 8px 8px; border-radius: 0 0 8px 8px;
z-index: 1; z-index: 1;
width: 95%; width: 95%;
@media (max-height: 450px) and (orientation: landscape) {
padding: 0.35rem;
}
} }
.stat-bar-overlay { .stat-bar-overlay {

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { AttackInfo, AttackTarget, CoreGameDarknessPhaseRule, DrawingBag, DrawingItem, HeroClass, IDarknessPhaseRule, MD2HeroInfo, MD2Icon, MD2Rules, MobInfo, MobType, RoundPhase, TreasureItem, TreasureType } from '../../games/massive-darkness2/massive-darkness2.model'; import { AttackInfo, AttackTarget, CoreGameDarknessPhaseRule, DrawingBag, DrawingItem, HeroClass, IDarknessPhaseRule, MD2EnemyPhaseSpecialInfo, MD2EnemyPhaseSpecialRule, MD2HeroInfo, MD2Icon, MD2Rules, MobInfo, MobType, RoundPhase, TreasureItem, TreasureType } from '../../games/massive-darkness2/massive-darkness2.model';
import { first, map, reduce } from "rxjs/operators"; import { first, map, reduce } from "rxjs/operators";
import { NbDialogService } from '@nebular/theme'; import { NbDialogService, NbThemeService } from '@nebular/theme';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { BossMicheal, BossReaper, IBossFight } from '../../games/massive-darkness2/massive-darkness2.model.boss'; import { BossMicheal, BossReaper, IBossFight } from '../../games/massive-darkness2/massive-darkness2.model.boss';
import { ADIcon, MessageBoxConfig } from '../../ui/alert-dlg/alert-dlg.model'; import { ADIcon, MessageBoxConfig } from '../../ui/alert-dlg/alert-dlg.model';
@ -29,7 +29,7 @@ export class MD2Service {
private _highestPlayerLevel: number = 1; private _highestPlayerLevel: number = 1;
private _playerAmount: number = 2; private _playerAmount: number = 2;
public specialRule: MD2EnemyPhaseSpecialInfo;
public info: MD2GameInfo; public info: MD2GameInfo;
public playerHero: MD2HeroInfo; public playerHero: MD2HeroInfo;
public mobInfos: MD2MobInfo[] = []; public mobInfos: MD2MobInfo[] = [];
@ -75,13 +75,15 @@ export class MD2Service {
public gameRoomService: GameRoomService, public gameRoomService: GameRoomService,
public loginUserService: LoginUserService, public loginUserService: LoginUserService,
public signalRService: SignalRService, public signalRService: SignalRService,
public dlgService: NbDialogService public dlgService: NbDialogService,
public themeService: NbThemeService
) { ) {
this.darknessPhaseRule = new CoreGameDarknessPhaseRule(); this.darknessPhaseRule = new CoreGameDarknessPhaseRule();
this.info = new MD2GameInfo(); this.info = new MD2GameInfo();
this.darknessPhaseRule.addTreasureToken.subscribe(treasureType => { this.darknessPhaseRule.addTreasureToken.subscribe(treasureType => {
this.addTreasure(treasureType, 1); this.addTreasure(treasureType, 1);
}); });
this.specialRule = new MD2EnemyPhaseSpecialInfo();
} }
// #endregion Constructors (1) // #endregion Constructors (1)
@ -263,10 +265,28 @@ export class MD2Service {
private getAttackInfo(attackInfo: MD2DiceSet): AttackInfo { private getAttackInfo(attackInfo: MD2DiceSet): AttackInfo {
return new AttackInfo(attackInfo.type as unknown as MD2Icon, attackInfo.yellow, attackInfo.orange, attackInfo.red, attackInfo.black); return new AttackInfo(attackInfo.type as unknown as MD2Icon, attackInfo.yellow, attackInfo.orange, attackInfo.red, attackInfo.black);
} }
public enemyPhase() { public enemyPhase(triggerSpecialRule: boolean = true) {
//this.msgBoxService //this.msgBoxService
//Draw a special rule
this.enemyPhaseMobs = this.roamingMonsters.concat(this.mobs); this.enemyPhaseMobs = this.roamingMonsters.concat(this.mobs);
if (this.mobs.length > 0 && triggerSpecialRule) {
let specialRuleDrawingBag = new DrawingBag<MD2EnemyPhaseSpecialRule>(this.specialRule.specialRules);
let specialRule = specialRuleDrawingBag.Draw(1)[0];
this.specialRule.specialRule = specialRule;
if (specialRule.description) {
this.themeService.changeTheme('dark');
this.msgBoxService.show(specialRule.title, { text: specialRule.description, icon: ADIcon.WARNING })
.pipe(first()).subscribe(result => {
this.enemyPhase(false);
});
return;
} else {
this.specialRule.specialRule = null;
}
}
if (this.enemyPhaseMobs.length > 0) { if (this.enemyPhaseMobs.length > 0) {
this.enemyPhaseMobs = ArrayUtils.Shuffle(this.enemyPhaseMobs); this.enemyPhaseMobs = ArrayUtils.Shuffle(this.enemyPhaseMobs);
//this.showEnemyPhaseAction(); //this.showEnemyPhaseAction();
@ -384,10 +404,11 @@ export class MD2Service {
this.info.roundPhase++; this.info.roundPhase++;
switch (this.info.roundPhase) { switch (this.info.roundPhase) {
case RoundPhase.HeroPhase: case RoundPhase.HeroPhase:
this.heros.forEach(hero => { //HeroPhase will be handled in the darkness phase
hero.remainActions = 3; // this.heros.forEach(hero => {
this.broadcastHeroInfoToOwner(hero); // hero.remainActions = 3;
}); // this.broadcastHeroInfoToOwner(hero);
// });
break; break;
case RoundPhase.EnemyPhase: case RoundPhase.EnemyPhase:
this.enemyPhase(); this.enemyPhase();
@ -397,6 +418,7 @@ export class MD2Service {
break; break;
case RoundPhase.DarknessPhase: case RoundPhase.DarknessPhase:
this.darknessPhase(); this.darknessPhase();
this.themeService.changeTheme('default');
break; break;
default: break; default: break;
} }

View File

@ -12,6 +12,6 @@
// background: nb-theme(color-primary-200) !important; // background: nb-theme(color-primary-200) !important;
// } // }
.label { // .label {
color: #736f6f; // color: #736f6f;
} // }