diff --git a/src/app/games/massive-darkness2/MD2Base.ts b/src/app/games/massive-darkness2/MD2Base.ts index b1a950f..af6e15c 100644 --- a/src/app/games/massive-darkness2/MD2Base.ts +++ b/src/app/games/massive-darkness2/MD2Base.ts @@ -81,11 +81,11 @@ export abstract class MD2Base { } abstract refreshUI(); handleSignalRCallback(message: SignalRMessage): void { - if (message.from.isGroup) { - if (!this.isHeroDashboard) return; - } else { - if (this.isHeroDashboard && this.md2Service.playerHero.playerInfo.signalRClientId == message.from.sessionId) return; - } + // if (message.from.isGroup) { + // if (!this.isHeroDashboard) return; + // } else { + // if (this.isHeroDashboard && this.md2Service.playerHero.playerInfo.signalRClientId == message.from.sessionId) return; + // } switch (message.actionType) { case 'hero': @@ -143,7 +143,7 @@ export abstract class MD2Base { case 'GameRoom': switch (message.actionName) { case 'Leaving': - this.md2Service.heros.splice(this.md2Service.heros.findIndex(h => h.playerInfo.signalRClientId == message.from.sessionId)); + this.md2Service.heros.splice(this.md2Service.heros.findIndex(h => h.playerInfo.tabId == message.from.sessionId)); this.detectChanges(); break; case 'update': @@ -158,6 +158,12 @@ export abstract class MD2Base { this.detectChanges(); } break; + case 'sendJoinInfo': + if (this.isHeroDashboard && this.md2Service.playerHero) { + this.md2Service.playerHero.playerInfo.signalRClientId = message.parameters['signalrconnid']; + this.md2Service.broadcastService.broadcastMyHeroInfo(); + } + break; default: break; } @@ -206,7 +212,7 @@ export abstract class MD2Base { break; case 'tradeAction': this.md2Service.msgBoxService.show('Trade and Equip', { - text: `every one in the same zone with ${this.md2Service.heroFullName(this.md2Service.currentActivateHero)} may freely trade and + text: `every one in the same zone with ${this.md2Service.heroFullName(this.md2Service.currentActivateHero)} may freely trade and equip items!`, icon: ADIcon.INFO }); diff --git a/src/app/games/massive-darkness2/factorys/roamingMonsters/CoreGame.ts b/src/app/games/massive-darkness2/factorys/roamingMonsters/CoreGame.ts index b0ee1aa..b3adc40 100644 --- a/src/app/games/massive-darkness2/factorys/roamingMonsters/CoreGame.ts +++ b/src/app/games/massive-darkness2/factorys/roamingMonsters/CoreGame.ts @@ -76,6 +76,29 @@ const CORE_GAME_MOB_LEVEL = [ attackInfos: [new AttackInfo(MD2Icon.Melee, 0, 3, 0, 3)], defenseInfo: new DefenseInfo(4, 1), }), + + + new MobInfo({ + name: 'Balrog', level: 1, hp: 5, + attackInfos: [ + new AttackInfo(MD2Icon.Magic, 0, 1, 0, 2), + ], + defenseInfo: new DefenseInfo(2, 1), + }), + new MobInfo({ + name: 'Balrog', level: 3, hp: 8, + attackInfos: [ + new AttackInfo(MD2Icon.Magic, 0, 2, 0, 2), + ], + defenseInfo: new DefenseInfo(3, 1), + }), + new MobInfo({ + name: 'Balrog', level: 5, hp: 10, + attackInfos: [ + new AttackInfo(MD2Icon.Magic, 0, 3, 0, 2), + ], + defenseInfo: new DefenseInfo(4, 1), + }), ] export abstract class CoreGameRMFactory implements IMobFactory { @@ -200,9 +223,6 @@ export class RMAndraFactory extends CoreGameRMFactory { }).pipe(first()).subscribe(result => { if (result) { mob.actions = 0; - mob.actionSubject.next( - `Undead Queen attacks each Hero in LoS(resolve each attack separately).` - ); msgBoxService.show('Is Any Hero in the LoS of Andra?', { icon: ADIcon.QUESTION, @@ -300,7 +320,7 @@ export class RMLyidanIncubusLordFactory extends CoreGameRMFactory { `The Incubus Lord got 3 Wounds, Move it to the closest Shadow Zone.` ); } else { - msgBoxService.show('Is there a Herp up to 3 Zones away(regardless of LoS) from The Incubus Lord?', { + msgBoxService.show('Is there a Hero up to 3 Zones away(regardless of LoS) from The Incubus Lord?', { icon: ADIcon.QUESTION, buttons: ADButtons.YesNo }).pipe(first()).subscribe(result => { @@ -329,9 +349,46 @@ export class RMLyidanIncubusLordFactory extends CoreGameRMFactory { return this.mob; } } + + +export class RMBalrogFactory extends CoreGameRMFactory { + mobName: string = 'Balrog'; + generate(level: number): MobInfo { + this.loadLevelInfo('Balrog', level); + this.mob.extraRule = `When Balrog is in the Dungeon, ${this.iconHtml(MD2Icon.Fire)} on Heros can't be removed, Heros still suffer its effects when activating.` + this.mob.activateFunction = (mob, msgBoxService, heros) => { + let actionResult = ''; + + mob.actions = 0; + let noFireHeros = heros.filter(h => h.fireToken == 0); + if (noFireHeros.length == 0) { + + mob.actions = 3; + mob.actionSubject.next( + `The Balrog gains 3 Actions` + ); + + } else { + let fireTokens = Math.round(Math.random() * 2) + 1; + mob.actionSubject.next( + `Balrog ,moves 2 Zones toward to ${MD2Logic.getTargetHerosHtml(noFireHeros)} and Each Hero in ${this.iconHtml(MD2Icon.Magic)} range takes ${fireTokens} ${this.iconHtml(MD2Icon.Fire)}` + ); + } + } + + this.mob.combatSkill = new MobSkill( + { + description: `The Hero takes 1 ${this.iconHtml(MD2Icon.Fire)}`, + type: MobSkillType.Combat + } + ) + return this.mob; + } +} export const CoreGameRMFactories = [ new RMUndeadQueenFactory(), new RMAndraFactory(), new RMTheGhoulFactory(), new RMLyidanIncubusLordFactory(), + new RMBalrogFactory() ]; \ No newline at end of file diff --git a/src/app/games/massive-darkness2/hero-dashboard/hero-dashboard.component.html b/src/app/games/massive-darkness2/hero-dashboard/hero-dashboard.component.html index bd34272..516753e 100644 --- a/src/app/games/massive-darkness2/hero-dashboard/hero-dashboard.component.html +++ b/src/app/games/massive-darkness2/hero-dashboard/hero-dashboard.component.html @@ -7,18 +7,45 @@
-
+
- + + +
+
+ + + + + +
+ + + +
+
+
+ +
+
+ +
+
- -
@@ -33,6 +60,7 @@
--> +
@@ -41,72 +69,90 @@
- - - +
+
+ + + + +
+ +
+ +
+
+ + + +
+
+ - +
+ +
+
- - - - +
+
+ + -
+
-
- - - - - +
+
+ + + + + +
+ +
- diff --git a/src/app/games/massive-darkness2/hero-dashboard/hero-dashboard.component.ts b/src/app/games/massive-darkness2/hero-dashboard/hero-dashboard.component.ts index a869c05..57405d6 100644 --- a/src/app/games/massive-darkness2/hero-dashboard/hero-dashboard.component.ts +++ b/src/app/games/massive-darkness2/hero-dashboard/hero-dashboard.component.ts @@ -11,7 +11,7 @@ import { ADButtonColor, ADButtons } from '../../../ui/alert-dlg/alert-dlg.model' import { ArrayUtils } from '../../../utilities/array-utils'; import { StringUtils } from '../../../utilities/string-utils'; import { DebounceTimer } from '../../../utilities/timer-utils'; -import { HeroClass, MD2HeroInfo } from '../massive-darkness2.model'; +import { HeroClass, MD2HeroInfo, MD2Icon } from '../massive-darkness2.model'; import { MD2Base } from '../MD2Base'; @Component({ @@ -65,6 +65,11 @@ export class HeroDashboardComponent extends MD2Base implements OnInit { new MD2HeroInfo({ name: 'Myriam', mpMaximum: 7, hpMaximum: 4, skillHtml: '', shadowSkillHtml: '' }), new MD2HeroInfo({ name: 'Valdis', mpMaximum: 6, hpMaximum: 4, skillHtml: '', shadowSkillHtml: '' }) ] + + public get hero() { + return this.md2Service.playerHero; + } + constructor( private gameRoomService: GameRoomService, public md2Service: MD2Service, @@ -78,7 +83,7 @@ export class HeroDashboardComponent extends MD2Base implements OnInit { } public get allowAttack(): boolean { - return this.md2Service.playerHero.uiBossFight || (!!this.md2Service.mobs && this.md2Service.mobs.length > 0) || (!!this.md2Service.roamingMonsters && this.md2Service.roamingMonsters.length > 0); + return this.hero.uiBossFight || (!!this.md2Service.mobs && this.md2Service.mobs.length > 0) || (!!this.md2Service.roamingMonsters && this.md2Service.roamingMonsters.length > 0); } ngOnInit(): void { @@ -94,7 +99,6 @@ export class HeroDashboardComponent extends MD2Base implements OnInit { } initHero() { this.gameRoomService.gameRoomId = this.roomId; - this.gameRoomService.joinGameRoom(this.roomId); if (!this.md2Service.heros.some(h => h.playerInfo.signalRClientId == this.stateService.loginUserService.userAccess.signalRSessionId)) { this.msgBoxService.showInputbox('Select Hero Class', '', { dropDownOptions: this.classOptions, inputType: 'dropdown' }) .pipe(first()).subscribe(heroClass => { @@ -150,6 +154,7 @@ export class HeroDashboardComponent extends MD2Base implements OnInit { if (result) { this.md2Service.playerJoin(heroInfo); this.detectChanges(); + this.gameRoomService.joinGameRoom(this.roomId); } else { index++; if (index == this.heros.length) index = 0; @@ -210,13 +215,27 @@ export class HeroDashboardComponent extends MD2Base implements OnInit { get allowStartAction() { return !this.md2Service.heros.some(h => h.uiActivating) && !this.hero.uiActivating && this.hero.remainActions > 0; } - - public get hero() { - return this.md2Service.playerHero; - } startActivation() { this.hero.uiActivating = true; + //this.hero.remainActions = 3; + if (this.hero.fireToken > 0) { + this.msgBoxService.show(`You Are On ${this.iconHtml(MD2Icon.Fire)}!`, { + text: `Roll ${this.iconHtml(MD2Icon.YellowDice)} ${this.hero.fireToken} times.` + }); + } + if (this.hero.frozenToken > 0) { + let loseActions = Math.min(this.hero.frozenToken, this.hero.remainActions); + this.hero.remainActions -= loseActions; + this.hero.frozenToken -= loseActions; + this.msgBoxService.show(`It's So Cold ${this.iconHtml(MD2Icon.Frost)}!`, { + text: `Lose ${loseActions} actions.` + }); + } + if (this.hero.remainActions == 0) { + this.hero.uiActivating = false; + } this.broadcastHeroInfo(); + } endActivation() { if (this.hero.remainActions > 0) { diff --git a/src/app/games/massive-darkness2/massive-darkness2.component.html b/src/app/games/massive-darkness2/massive-darkness2.component.html index 79ff404..c62ed5a 100644 --- a/src/app/games/massive-darkness2/massive-darkness2.component.html +++ b/src/app/games/massive-darkness2/massive-darkness2.component.html @@ -15,12 +15,15 @@
- Game Info + + + @@ -41,8 +44,7 @@
-
- + - +
@@ -77,10 +84,38 @@
-
+ + +
+ +
+
+ +
+
+ +
+
+ +
+ + +
diff --git a/src/app/games/massive-darkness2/massive-darkness2.component.ts b/src/app/games/massive-darkness2/massive-darkness2.component.ts index 53ad224..5bfdce5 100644 --- a/src/app/games/massive-darkness2/massive-darkness2.component.ts +++ b/src/app/games/massive-darkness2/massive-darkness2.component.ts @@ -16,6 +16,7 @@ import { StringUtils } from '../../utilities/string-utils'; import { SpawnMobDlgComponent } from './mobs/spawn-mob-dlg/spawn-mob-dlg.component'; import { BossMicheal } from './massive-darkness2.model.boss'; import { MD2InitService } from '../../services/MD2/md2-init.service'; +import { NumberUtils } from '../../utilities/number-utils'; @Component({ selector: 'ngx-massive-darkness2', @@ -137,4 +138,26 @@ export class MassiveDarkness2Component extends MD2Base implements OnInit { this.md2Service.enterBossFight(); } + accessHealFountain() { + this.md2Service.drawingHealFountain(); + } + broadcastHeros() { + this.md2Service.heros.forEach(hero => { + hero.uiShowAttackBtn = this.md2Service.mobs.length > 0 || this.md2Service.roamingMonsters.length > 0 || this.md2Service.info.isBossFight; + }); + this.md2Service.broadcastService.broadcastAllHeroInfoToAll(); + } + removeHero(hero) { + this.md2Service.info.heros.splice(this.md2Service.info.heros.indexOf(hero)); + } + + + public get round(): string { + if (this.md2Service.info.isBossFight) { + return `Boss Fight ${NumberUtils.Ordinal(this.md2Service.info.boss.rounds)} Round`; + } else { + return NumberUtils.Ordinal(this.md2Service.info.round) + ' Round'; + } + } + } \ No newline at end of file diff --git a/src/app/games/massive-darkness2/massive-darkness2.logic.ts b/src/app/games/massive-darkness2/massive-darkness2.logic.ts index 0106c95..d99f229 100644 --- a/src/app/games/massive-darkness2/massive-darkness2.logic.ts +++ b/src/app/games/massive-darkness2/massive-darkness2.logic.ts @@ -7,7 +7,9 @@ import { GamePlayer } from "../games.model"; import { MD2HeroInfo, AttackTarget, HeroClass } from "./massive-darkness2.model"; import { MobSkill } from "./massive-darkness2.model.boss"; export class MD2Logic { - + public static getTargetHeroByFilter(heros: MD2HeroInfo[], targetType: AttackTarget) { + return this.getTargetHerosByFilter(heros, targetType, true)[0]; + } public static getTargetHerosByFilter(heros: MD2HeroInfo[], targetType: AttackTarget, onlyOne: boolean = false) { let beenAttackedHero = [] as MD2HeroInfo[]; switch (targetType) { diff --git a/src/app/games/massive-darkness2/massive-darkness2.model.ts b/src/app/games/massive-darkness2/massive-darkness2.model.ts index 07b2b31..3a1a169 100644 --- a/src/app/games/massive-darkness2/massive-darkness2.model.ts +++ b/src/app/games/massive-darkness2/massive-darkness2.model.ts @@ -324,7 +324,7 @@ export class MobInfo implements IDrawingItem { uiFrozenTokens: number; uiCorruptionTokens: number; uiAttackedBy: string; - + extraRule: string; get identifyName(): string { return `${this.name}_${this.level}`; } @@ -398,6 +398,7 @@ export class MD2HeroInfo { uiActivating = false; uiShowCorruptionToken = false; uiBossFight = false; + uiShowAttackBtn = false; public get heroFullName(): string { return `${this.playerInfo.name} (${HeroClass[this.class]} - ${this.name})` @@ -488,7 +489,7 @@ export class CoreGameDarknessPhaseRule implements IDarknessPhaseRule { switch (this.round) { case 3: case 9: - this.spawnMob.next(); + this.spawnRoamingMonster.next(); return false; break; case 4: @@ -496,7 +497,7 @@ export class CoreGameDarknessPhaseRule implements IDarknessPhaseRule { break; case 5: case 7: - this.spawnRoamingMonster.next(); + this.spawnMob.next(); return false; break; case 6: diff --git a/src/app/games/massive-darkness2/mobs/mob-detail-info/mob-attack-info/mob-attack-info.component.html b/src/app/games/massive-darkness2/mobs/mob-detail-info/mob-attack-info/mob-attack-info.component.html index 12646d4..2ded2f2 100644 --- a/src/app/games/massive-darkness2/mobs/mob-detail-info/mob-attack-info/mob-attack-info.component.html +++ b/src/app/games/massive-darkness2/mobs/mob-detail-info/mob-attack-info/mob-attack-info.component.html @@ -20,9 +20,9 @@ x{{info.red}}
-
+
- x{{mob.defenseInfo.black}} + x{{info.black}}
diff --git a/src/app/games/massive-darkness2/mobs/mob-detail-info/mob-detail-info.component.html b/src/app/games/massive-darkness2/mobs/mob-detail-info/mob-detail-info.component.html index 84840b3..8c38f50 100644 --- a/src/app/games/massive-darkness2/mobs/mob-detail-info/mob-detail-info.component.html +++ b/src/app/games/massive-darkness2/mobs/mob-detail-info/mob-detail-info.component.html @@ -50,4 +50,8 @@ - \ No newline at end of file + +
+ +
\ No newline at end of file diff --git a/src/app/games/massive-darkness2/mobs/mobs.component.html b/src/app/games/massive-darkness2/mobs/mobs.component.html index 9676635..9b38ef7 100644 --- a/src/app/games/massive-darkness2/mobs/mobs.component.html +++ b/src/app/games/massive-darkness2/mobs/mobs.component.html @@ -3,10 +3,10 @@ {{(isRoamingMonster?'Roaming Monsters':'Mobs')}} - -