ID:144203
 
Code:
        Attack()
var/list/hitem = Enemies()
var/mob/go = input(src,"Who do you want to attack?","Attack") in hitem
switch(go)
if("Cancel")
src.Turn()
return
world << "[go]"
var/damage = src.taijutsu+rand(1,5)
go.Damage(src,"Punch",damage,1,1)


Problem description:
When the list pops up, it has, Test Ninja, and Test Ninja's Friend which is what its supposed to have because those are your enemies. But then, no matter who you choose to attack, it always chooses Test Ninja, which makes no sense because the var/mob/go should be set to whoever you choose. So if you choose Test Ninja's Friend, it will still say "Test Ninja" on the world << "[go]" part. It makes no sense, not to mention this is the same exact code in my turn based battle demo and it works perfectly fine in there, everything's the same...
We'd probably need to see how the Enemies() proc works to be sure what's happening here. One thing is for sure though: You should not be adding "Cancel" to the list, or even using switch() here. (Never use switch() when just one choice is being tested.) The correct way to implement a cancel choice is like so:

var/mob/go = input(src,"Who do you want to attack?","Attack") as null|anything in hitem
if(!go)
src.Turn()
return
...


Lummox JR
In response to Lummox JR
I fixed it, although I don't know why it was like that.

I had:
    Test_Ninja
hp = 60
chakra = 30
New()
..()
src.team+=src
var/mob/A = new/mob/enemy/Test_Ninja_Friend
var/mob/B = new/mob/enemy/Test_Ninja_Friend
src.team += A
src.team += B
A.team = src.team
B.team = src.team
Test_Ninja_Friend
name = "Test Ninja's Friend"
hp = 60
chakra = 30


So somehow it was mixing them up, however it works perfectly fine with Leaf_Ninja (as Test_Ninja) and Leaf_Ninja_2 (as Test_Ninja_Friend)

All I did was change the name of the mob v.v