Skip to content

Commit

Permalink
BUG ao-libre#344 Se arregla el hechizo inmovilizar, y con el los hech…
Browse files Browse the repository at this point in the history
…izos aumentar fuerza y aumentar agilidad. Se añade un mensaje que faltaba para avisar de que no tienes maná ao-libre#322. Enlazado con ao-libre#344 inmovilizar ya consume, maná.
  • Loading branch information
vicosdev authored and vmosuna committed May 7, 2020
1 parent cccc5ce commit 6534630
Showing 1 changed file with 29 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ private void castSpell(int playerId, int target, Spell spell) {
int fxGrh = spell.getFxGrh();
E targetEntity = E( target );
int damage;

if(spell.getSumHP() > 0) {
Health health = targetEntity.getHealth();
damage = calculateMagicDamage( playerId, target, spell );
Expand All @@ -144,34 +145,6 @@ private void castSpell(int playerId, int target, Spell spell) {
soundEntitySystem.add( playerId, 126 );

}
if(spell.isImmobilize()) {
targetEntity.immobile();
victimUpdateToAllBuilder.withComponents( targetEntity.getImmobile() );
} else if(spell.isRemoveParalysis()) {
if(targetEntity.isImmobile()) {
targetEntity.immobile( false );
victimUpdateToAllBuilder.remove( Immobile.class );
} else {
notifyInfo( playerId, Messages.NOT_PARALYSIS );
return;
}
}

if(spell.isSumStrength()) {
int random = new Random().nextInt( spell.getMaxStrength() - spell.getMinStrength() + 1 ) + spell.getMinStrength();
targetEntity.strengthCurrentValue( targetEntity.strengthCurrentValue() + random );
targetEntity.buff().buffAddAttribute( targetEntity.getStrength(), spell.getStrengthDuration() );
sendAttributeUpdate( target, targetEntity.getStrength(), targetEntity.getBuff() );
}

if(spell.isSumAgility()) {
int random = new Random().nextInt( spell.getMaxAgility() - spell.getMinAgility() + 1 ) + spell.getMinAgility();
targetEntity.agilityCurrentValue( targetEntity.agilityCurrentValue() + random );
targetEntity.buff().buffAddAttribute( targetEntity.getAgility(), spell.getAgilityDuration() );
sendAttributeUpdate( target, targetEntity.getAgility(), targetEntity.getBuff() );
}


if(fxGrh > 0) {
effectEntitySystem.addFX( target, fxGrh, Math.max( 1, spell.getLoops() ) );
}
Expand All @@ -192,10 +165,36 @@ private void castSpell(int playerId, int target, Spell spell) {

EntityUpdate playerUpdate = playerUpdateBuilder.withComponents( magicWords ).build();
entityUpdateSystem.add( playerUpdate, UpdateTo.ALL );
} else {
notifyInfo( playerId, Messages.DEAD_CANT_ATTACK );

} else if(spell.isImmobilize()) {/*Inmovilizar*/
targetEntity.immobile();
victimUpdateToAllBuilder.withComponents( targetEntity.getImmobile() );
} else if(spell.isRemoveParalysis()) {
if(targetEntity.isImmobile()) {
targetEntity.immobile( false );
victimUpdateToAllBuilder.remove( Immobile.class );
} else {
notifyInfo( playerId, Messages.NOT_PARALYSIS );
return;
}
}else if(spell.isSumStrength()) {/*Sumar fuerza*/
int random = new Random().nextInt( spell.getMaxStrength() - spell.getMinStrength() + 1 ) + spell.getMinStrength();
targetEntity.strengthCurrentValue( targetEntity.strengthCurrentValue() + random );
targetEntity.buff().buffAddAttribute( targetEntity.getStrength(), spell.getStrengthDuration() );
sendAttributeUpdate( target, targetEntity.getStrength(), targetEntity.getBuff() );
}else if(spell.isSumAgility()) {/*Sumar agilidad*/
int random = new Random().nextInt( spell.getMaxAgility() - spell.getMinAgility() + 1 ) + spell.getMinAgility();
targetEntity.agilityCurrentValue( targetEntity.agilityCurrentValue() + random );
targetEntity.buff().buffAddAttribute( targetEntity.getAgility(), spell.getAgilityDuration() );
sendAttributeUpdate( target, targetEntity.getAgility(), targetEntity.getBuff() );
}

}else{
notifyInfo(playerId,Messages.NOT_ENOUGHT_MANA);

}
}else {
notifyInfo( playerId, Messages.DEAD_CANT_ATTACK );
}
}

Expand Down

0 comments on commit 6534630

Please sign in to comment.