get room object

This commit is contained in:
yuexin 2020-12-03 19:39:58 +08:00
parent 61fe65bf5b
commit b595957a5d
4 changed files with 28 additions and 6 deletions

View File

@ -22,7 +22,7 @@ export class GeneralRoom extends Room {
onCreate (options: any) {
let cs = new CardGameState();
this.setState(cs);
this.battleMan.init(cs);
this.battleMan.init(cs, this);
this.clock.start();
this.state.gameSate = 0;
this.onMessage("play_ready_c2s", (client, message) => {

View File

@ -6,15 +6,18 @@ import CfgMan from "../CfgMan";
import { EffectCardType } from "../skill/SkillConst";
import { Pet } from "rooms/schema/Pet";
import {SkillParam} from "../skill/SkillParam";
import { Room } from "colyseus";
export class BattleHandler {
private _cs: CardGameState;
private _players: Map<Player, PlayerHandler> = new Map();
private _room: Room;
public init(cs: CardGameState){
public init(cs: CardGameState, room: Room){
this._cs = cs;
this._room = room;
};
public addPlayer(aplayer: Player){
@ -31,6 +34,13 @@ export class BattleHandler {
return aplayer? this._players.get(aplayer): null;
};
public getTargetPets(){
};
public getTargetPlayer(){
};
/**
* 使
* @param obj

View File

@ -127,6 +127,18 @@ export class Skill {
return this._data && (this._data.tigger_typeid == TriggerType.NO_COND);
};
isEffectValidPet(apet: PetHandler){
switch(this._data.rangeid){
case SkillRangeUnitType.SELF:
return this._owner == apet;
case SkillRangeUnitType.OTHER:
case SkillRangeUnitType.ALL_EXSELF:
return this._owner != apet;
default:
return true;
}
};
canEffectPet(apet: PetHandler){
switch(this._data.targetid){
case GameUnitType.PLAYER:
@ -140,7 +152,6 @@ export class Skill {
default:
return true;
}
};
canEffectCamp(aplayer: PlayerHandler){

View File

@ -63,9 +63,10 @@ export const enum SkillType{
export const enum SkillRangeUnitType{
NONE = 0,
SELF = 1,
OTHER = 2,
ALL = 3,
ALL_EXSELF = 4,
SINGLE = 2,
OTHER = 3,
ALL = 4,
ALL_EXSELF = 5,
};
// 技能效果类型