Skip to content

Commit

Permalink
Add several character states
Browse files Browse the repository at this point in the history
Hero: Frozen, Immune
Minion: Enraged, Immune, Silenced, Untargetable, Buffed

Progress on #7.
  • Loading branch information
azeier authored and beheh committed Oct 10, 2016
1 parent 2dd87c2 commit 304b409
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 3 deletions.
Binary file added assets/images/inplay_hero_frozen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/inplay_hero_immune.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/inplay_minion_buffed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/inplay_minion_enraged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/inplay_minion_immune.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/inplay_minion_silenced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/inplay_minion_untargetable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions less/entities.less
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
div.visuals {
.inplay-base, .inplay-legendary, .inplay-taunt, .inplay-shield, .inplay-frozen, .inplay-divine-shield,
.inplay-stealth, .icon-deathrattle, .icon-trigger, .icon-inspire, .icon-poisonous,
.effect-sleep {
.effect-sleep, .inplay-enraged, .inplay-silenced, .inplay-immune, .inplay-untargetable,
.inplay-buffed {
height: 100%;
}
.inplay-divine-shield {
Expand Down Expand Up @@ -257,7 +258,7 @@
}

div.visuals {
.hero-frame, .hero-attack, .hero-armor, .secret{
.hero-frame, .hero-attack, .hero-armor, .secret, .hero-frozen, .hero-immune {
height: 100%;
}
.skull {
Expand Down
16 changes: 16 additions & 0 deletions ts/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ export default class Entity {
return this.getTag(GameTag.STEALTH) > 0;
}

public isImmune():boolean {
return this.getTag(GameTag.IMMUNE) > 0;
}

public isSilenced():boolean {
return this.getTag(GameTag.SILENCED) > 0;
}

public isDivineShielded():boolean {
return this.getTag(GameTag.DIVINE_SHIELD) > 0;
}
Expand All @@ -96,6 +104,14 @@ export default class Entity {
return this.getTag(GameTag.FROZEN) > 0;
}

public isEnraged():boolean {
return this.getTag(GameTag.ENRAGED) > 0 && this.getDamage() > 0;
}

public cantBeTargeted():boolean {
return this.getTag(GameTag.CANT_BE_TARGETED_BY_ABILITIES) > 0;
}

public getZonePosition():number {
return this.getTag(GameTag.ZONE_POSITION);
}
Expand Down
1 change: 1 addition & 0 deletions ts/components/game/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class Field extends EntityList<EntityListProps> {
cards={this.props.cards}
controller={this.props.controller}
descriptors={this.props.descriptors}
buffed={entity && this.props.buffedEntities && this.props.buffedEntities.indexOf(entity.id) !== -1}
/>);
}
}
1 change: 1 addition & 0 deletions ts/components/game/Minion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export default class Minion extends EntityInPlay<EntityInPlayProps> {
cardArtDirectory={this.props.cardArtDirectory}
damage={damage}
healing={healing}
buffed={this.props.buffed}
/>,
<div key="stats" className="stats">
{entity.getTag(GameTag.HIDE_STATS) == 0 ? [
Expand Down
9 changes: 9 additions & 0 deletions ts/components/game/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ export default class Player extends React.Component<PlayerProps, void> {
let playEntities = this.props.entities.get(Zone.PLAY) || Immutable.Map<number, Entity>();
let playOptions = this.props.options.get(Zone.PLAY) || Immutable.Map<number, Option>();

let buffedEntities = [];
playEntities.forEach(entity => {
let attached = entity.getTag(GameTag.ATTACHED);
if (attached && buffedEntities.indexOf(attached) === -1) {
buffedEntities.push(attached);
}
});

/* Equipment */
let heroEntity = playEntities.filter(filterByCardType(CardType.HERO)).first();
if (!heroEntity) {
Expand Down Expand Up @@ -170,6 +178,7 @@ export default class Player extends React.Component<PlayerProps, void> {
cardArtDirectory={this.props.cardArtDirectory}
controller={this.props.player}
descriptors={this.props.descriptors}
buffedEntities={buffedEntities}
/>;
let deck = <Deck entities={this.props.entities.get(Zone.DECK) || emptyEntities}
options={this.props.options.get(Zone.DECK) || emptyOptions}
Expand Down
14 changes: 14 additions & 0 deletions ts/components/game/visuals/HeroArt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ export default class HeroArt extends React.Component<HeroArtProps, void> {
classes: ["hero-frame"]
});

if (entity.isFrozen()) {
images.push({
image: "inplay_hero_frozen.png",
classes: ["hero-frozen"]
});
}

if (entity.isImmune()) {
images.push({
image: "inplay_hero_immune.png",
classes: ["hero-immune"]
});
}

if (entity.getAtk() > 0) {
images.push({
image: "hero_attack.png",
Expand Down
38 changes: 37 additions & 1 deletion ts/components/game/visuals/InPlayCardArt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export default class InPlayCardArt extends React.Component<EntityProps, void> {
nextProps.healing !== this.props.healing ||
nextProps.controller !== this.props.controller ||
nextProps.assetDirectory !== this.props.assetDirectory ||
nextProps.cardArtDirectory !== this.props.cardArtDirectory
nextProps.cardArtDirectory !== this.props.cardArtDirectory ||
nextProps.buffed !== this.props.buffed
);
}

Expand Down Expand Up @@ -46,6 +47,13 @@ export default class InPlayCardArt extends React.Component<EntityProps, void> {
});
}

if (entity.cantBeTargeted()) {
images.push({
image: "inplay_minion_untargetable.png",
classes: ["inplay-untargetable"]
});
}

if (entity.getTag(GameTag.HIDE_STATS)) {
images.push({
image: `inplay_minion_hide_stats${postfix}.png`,
Expand Down Expand Up @@ -79,6 +87,34 @@ export default class InPlayCardArt extends React.Component<EntityProps, void> {
});
}

if (entity.isImmune()) {
images.push({
image: "inplay_minion_immune.png",
classes: ["inplay-immune"]
});
}

if (entity.isSilenced()) {
images.push({
image: "inplay_minion_silenced.png",
classes: ["inplay-silenced"]
});
}

if (entity.isEnraged()) {
images.push({
image: "inplay_minion_enraged.png",
classes: ["inplay-enraged"]
});
}

if (this.props.buffed) {
images.push({
image: "inplay_minion_buffed.png",
classes: ["inplay-buffed"]
});
}

if (entity.getTag(GameTag.INSPIRE) > 0) {
images.push({
image: "icon_inspire.png",
Expand Down
3 changes: 3 additions & 0 deletions ts/interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Rank from "./components/game/Rank";

export interface EntityInPlayProps extends EntityProps, OptionProps, GameStateDescriptorStackProps, React.ClassAttributes<any> {
isTarget?: boolean;
buffed?: boolean;
}

export interface EntityInPlayState {
Expand All @@ -23,6 +24,7 @@ export interface EntityListProps extends OptionCallbackProps, ControllerProps, C
entities: Immutable.Iterable<number, Entity>;
options?: Immutable.Iterable<number, Option>;
isTop?: boolean;
buffedEntities?: number[];
}

export interface ControllerProps {
Expand All @@ -33,6 +35,7 @@ export interface EntityProps extends CardDataProps, ControllerProps, AssetDirect
entity: Entity;
damage?: number;
healing?: number;
buffed?: boolean;
}

export interface OptionCallbackProps {
Expand Down

0 comments on commit 304b409

Please sign in to comment.