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;
mobLevelInfos: MD2MobLevelInfo[];
skills: MD2MobSkill[];
bossFightProfile?: BossFightProfile;
}
export interface MD2MobLevelInfo {
@ -67,4 +68,30 @@ export interface MD2DiceSet {
blue: number | null;
green: 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
.hero-stats-overlay {
position: absolute;
bottom: 0;
position: relative;
bottom: 60px;
left: 0;
right: 0;
padding: 0.5rem;
@ -41,9 +41,6 @@
border-radius: 0 0 8px 8px;
z-index: 1;
width: 95%;
@media (max-height: 450px) and (orientation: landscape) {
padding: 0.35rem;
}
}
.stat-bar-overlay {

View File

@ -1,7 +1,7 @@
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 { NbDialogService } from '@nebular/theme';
import { NbDialogService, NbThemeService } from '@nebular/theme';
import { Subject } from 'rxjs';
import { BossMicheal, BossReaper, IBossFight } from '../../games/massive-darkness2/massive-darkness2.model.boss';
import { ADIcon, MessageBoxConfig } from '../../ui/alert-dlg/alert-dlg.model';
@ -29,7 +29,7 @@ export class MD2Service {
private _highestPlayerLevel: number = 1;
private _playerAmount: number = 2;
public specialRule: MD2EnemyPhaseSpecialInfo;
public info: MD2GameInfo;
public playerHero: MD2HeroInfo;
public mobInfos: MD2MobInfo[] = [];
@ -75,13 +75,15 @@ export class MD2Service {
public gameRoomService: GameRoomService,
public loginUserService: LoginUserService,
public signalRService: SignalRService,
public dlgService: NbDialogService
public dlgService: NbDialogService,
public themeService: NbThemeService
) {
this.darknessPhaseRule = new CoreGameDarknessPhaseRule();
this.info = new MD2GameInfo();
this.darknessPhaseRule.addTreasureToken.subscribe(treasureType => {
this.addTreasure(treasureType, 1);
});
this.specialRule = new MD2EnemyPhaseSpecialInfo();
}
// #endregion Constructors (1)
@ -263,10 +265,28 @@ export class MD2Service {
private getAttackInfo(attackInfo: MD2DiceSet): AttackInfo {
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
//Draw a special rule
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) {
this.enemyPhaseMobs = ArrayUtils.Shuffle(this.enemyPhaseMobs);
//this.showEnemyPhaseAction();
@ -384,10 +404,11 @@ export class MD2Service {
this.info.roundPhase++;
switch (this.info.roundPhase) {
case RoundPhase.HeroPhase:
this.heros.forEach(hero => {
hero.remainActions = 3;
this.broadcastHeroInfoToOwner(hero);
});
//HeroPhase will be handled in the darkness phase
// this.heros.forEach(hero => {
// hero.remainActions = 3;
// this.broadcastHeroInfoToOwner(hero);
// });
break;
case RoundPhase.EnemyPhase:
this.enemyPhase();
@ -397,6 +418,7 @@ export class MD2Service {
break;
case RoundPhase.DarknessPhase:
this.darknessPhase();
this.themeService.changeTheme('default');
break;
default: break;
}

View File

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