Merge branch 'master' of git.kingsome.cn:node/card_svr
This commit is contained in:
commit
fb7aa9fff6
@ -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) => {
|
||||
|
@ -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
|
||||
|
@ -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){
|
||||
|
@ -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,
|
||||
};
|
||||
|
||||
// 技能效果类型
|
||||
|
Loading…
x
Reference in New Issue
Block a user