console.log("Hello World");

// console.log("Hello World");

//Strictly Follow the property names and spelling given in the google slide instructions.
//Note: Do not change any variable and function names. 
//All variables and functions to be checked are listed in the exports.

// Create an object called trainer using object literals

// Initialize/add the given object properties and methods

// Properties

// Methods

// Check if all properties and methods were properly added


// Access object properties using dot notation

// Access object properties using square bracket notation

// Access the trainer "talk" method


// Create a constructor function called Pokemon for creating a pokemon


// Create/instantiate a new pokemon


// Create/instantiate a new pokemon


// Create/instantiate a new pokemon


// Invoke the tackle method and target a different object


// Invoke the tackle method and target a different object

//=============================================================================

let trainer = {
	name: "Ash Ketchup",
	age: 24,
	pokemon: ["Pikachu", "Squirtle", "Charmander", "Bulbasaur"],
	friends: {
		hoenCity:["May", "Max"],
		kantoCity:["Brock", "Misty"],
		zuittCity:["Josua", "Chris", "JP", "Ron"]
	},
	talk: function(){
		console.log("Pikachu! I choose you!");
	}
}

console.log("Trainer's name: " + trainer.name)
console.log("Age: " + trainer.age);
trainer.talk();
console.log(trainer.name + " summons " + trainer.pokemon[0] + "!");

let myPokemon = {
    name: "Pikachu",
    level: 3,
    health: 100,
    attack: 50,
    tackle: function(){
        console.log( "This Pokemon tackled targetPokemon");
        console.log( "targetPokemon's health is now reduced to _targetPokemonhealth_");
    },
    faint : function() {
     console.log("Pokemon fainted");
    }
}

console.log(myPokemon);

function Pokemon(name, level, attack) {

    // Properties
    this.name = name;
    this.level = level;
    this.health = 2 * level;
    this.attack = level;

    //Methods
    this.tackle = function(target) {
        console.log(this.name + ' tackled ' + target.name);
        console.log(target.name + " health is now reduced to " + target.health);
        };     
    this.faint = function(){
        console.log(this.name + ' fainted. ');
    }
}

let pikachu = new Pokemon("Pikachu", 16);
let rattata = new Pokemon('Rattata', 8);
let raichu = new Pokemon('Raichu', 50, 50);

pikachu.tackle(raichu);
// pickachu.attack(raichu);
raichu.faint(pikachu);


























//Do not modify
//For exporting to test.js
//Note: Do not change any variable and function names. All variables and functions to be checked are listed in the exports.
try{
    module.exports = {

        trainer: typeof trainer !== 'undefined' ? trainer : null,
        Pokemon: typeof Pokemon !== 'undefined' ? Pokemon : null

    }
} catch(err){

}