removed attack from enemyAI
This commit is contained in:
		
							parent
							
								
									a05c0a1721
								
							
						
					
					
						commit
						502af9c7eb
					
				| 
						 | 
					@ -282,21 +282,6 @@ export default class EnemyAI extends StateMachineGoapAI implements BattlerAI {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //TODO - GOAP NOT WORKING, ATTACK WORKAROUND
 | 
					 | 
				
			||||||
        if(this.getPlayerPosition() ==  null){
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        let distance = this.owner.position.distanceTo(this.getPlayerPosition());
 | 
					 | 
				
			||||||
        if( distance <= 20){
 | 
					 | 
				
			||||||
            if( this.direction ==  Math.sign(this.getPlayerPosition().x -this.owner.position.x) ){
 | 
					 | 
				
			||||||
                let dir = this.getPlayerPosition().clone().sub(this.owner.position).normalize();
 | 
					 | 
				
			||||||
                if(this.attackTimer.isStopped()){
 | 
					 | 
				
			||||||
                    this.weapon.use(this.owner, "enemy", dir.scale(1,0))
 | 
					 | 
				
			||||||
                    this.attackTimer.start();
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -287,27 +287,25 @@ export default class GameLevel extends Scene {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    case Player_Events.GIVE_BUFF:
 | 
					                    case Player_Events.GIVE_BUFF:
 | 
				
			||||||
                        this.buffs = (<PlayerController>this.player._ai).generateBuffs();
 | 
					                        this.buffs = (<PlayerController>this.player._ai).generateBuffs();
 | 
				
			||||||
                        if(this.buffs[0].string !== undefined){
 | 
					                        if(this.buffs[0].string === undefined){
 | 
				
			||||||
                            //this.buffButton1.text = this.buffs[0].string;
 | 
					 | 
				
			||||||
                            this.buffLabel1.text = this.buffs[0].string;
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        else{
 | 
					 | 
				
			||||||
                            //this.buffButton1.text = "Increase "+this.buffs[0].type + " by "+this.buffs[0].value;
 | 
					 | 
				
			||||||
                            this.buffLabel1.text = "Increase "+this.buffs[0].type + "\n by \n"+this.buffs[0].value;
 | 
					                            this.buffLabel1.text = "Increase "+this.buffs[0].type + "\n by \n"+this.buffs[0].value;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        
 | 
					 | 
				
			||||||
                        if(this.buffs[1].string !== undefined){
 | 
					 | 
				
			||||||
                            this.buffLabel2.text = this.buffs[1].string;
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                        else{
 | 
					                        else{
 | 
				
			||||||
 | 
					                            this.buffLabel1.text = this.buffs[0].string;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        
 | 
				
			||||||
 | 
					                        if(this.buffs[1].string === undefined){
 | 
				
			||||||
                            this.buffLabel2.text = "Increase "+this.buffs[1].type + "\n by \n"+this.buffs[1].value;
 | 
					                            this.buffLabel2.text = "Increase "+this.buffs[1].type + "\n by \n"+this.buffs[1].value;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					                        else{
 | 
				
			||||||
 | 
					                            this.buffLabel2.text = this.buffs[1].string;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                        
 | 
					                        
 | 
				
			||||||
                        if(this.buffs[2].string !== undefined){
 | 
					                        if(this.buffs[2].string === undefined){
 | 
				
			||||||
                            this.buffLabel3.text = this.buffs[2].string;
 | 
					                            this.buffLabel3.text = "Increase "+this.buffs[2].type + "\n by \n"+this.buffs[2].value;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        else{
 | 
					                        else{
 | 
				
			||||||
                            this.buffLabel3.text = "Increase "+this.buffs[2].type + "\n by \n"+this.buffs[2].value;
 | 
					                            this.buffLabel3.text = this.buffs[2].string;
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        
 | 
					                        
 | 
				
			||||||
                        //pause game here 
 | 
					                        //pause game here 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user