BananaPhone42
2018-01-24T19:20:35Z
Before we start, if you think I'm making the game easier, then feel free to think that. I did it on a mere whim.

I dunno if anyone's ever done this before, but I've made it so where you gain the benefits of the "ai-cheating.lua" Here's a file in case you're wanting to try it out for yourself. With this AI, you:

+Gain 500 LP during your Draw Phase and draw 1 extra card.
+Can Normal Summon up to 5 times.
+Cannot lose the Duel if your LP reaches 0 (however, you can lose due to card effects such as Duel Winners like Exodia.)

New Features (Optional additions):
+Cannot lose the Duel by Decking Out nor effect
+Can have more than 10 cards in your Hand.
+Your monsters can have a permanent 500 ATK/DEF boost (This can be modified to whatever you like).
+Monsters in your hand can either have their Level raised or lowered, making it easier/harder to summon them.
+Monsters on your side of the field can count as two tributes.
+Monsters in the Monster Zone cannot be destroyed by battle and/or effect.
+Your opponent's hand is always face-up.
+You need one less tribute for Higher-Level Monsters.
+Any of your Monsters can declare an Attack in Defense Position.
+Battle Damage your opponent inflicts on you is bounced back.
+You only need to pay 1 Life Point in order to activate anything at all.
+Your opponent cannot use Monster Effects (Change to LOCATION_SZONE so the opponent cannot use Spells/Traps, or LOCATION_ONFIELD so that your opponent cannot use either of them).
+Assuming your Monsters were to be destroyed by Battle only, they return to your Hand.
+Activate Trap Cards in your Hand.
+Your monsters cannot be targeted as either Battle or Effect targets.
+Instead of taking damage, you absorb any direct damage you take.
+Inflict Piercing damage to your opponent, no matter what.
+Never take any Battle Damage and/or Effect Damage*.
+Attack Directly at will.
+Your opponent's effects will not Trigger anywhere.
+You can forbid your opponent from being able to attack.

* - e26 and e27 must be used together for it to work.

If you'd rather not download it, you can copy and paste it onto the "ai-cheating.lua" down below.

-- A cheating AI file, which draws additional cards and recovers LP each turn


-- Configure these to your liking

require("ai.ai")

EXTRA_SUMMON = 5
EXTRA_DRAW = 1
LP_RECOVER = 500

GlobalCheating = true

math.randomseed( require("os").time() )
function EnableCheats()
  local e1=Effect.GlobalEffect()
  e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
  e1:SetCode(EVENT_PHASE+PHASE_DRAW)
  e1:SetCountLimit(1)
  e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
    return Duel.GetTurnPlayer()==1-player_ai
  end)
  e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) 
    --AI.Chat("Oh yeah, cheating feels good.")
    Duel.Draw(1-player_ai,EXTRA_DRAW,REASON_RULE) 
    Duel.Recover(1-player_ai,LP_RECOVER,REASON_RULE) 
  end)
  Duel.RegisterEffect(e1,player_ai)
  local e2=Effect.GlobalEffect()
	e2:SetType(EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_SET_SUMMON_COUNT_LIMIT)
	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e2:SetTargetRange(1,0)
	e2:SetValue(EXTRA_SUMMON)
	Duel.RegisterEffect(e2,1-player_ai)
  local e3=Effect.GlobalEffect()
    e3:SetType(EFFECT_TYPE_FIELD)
	e3:SetCode(EFFECT_CANNOT_LOSE_LP)
    e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
    e3:SetTargetRange(1,0)
    e3:SetValue(1)
  Duel.RegisterEffect(e3,1-player_ai)
end

New Features (Optional):
local e4=Effect.GlobalEffect()
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_LOSE_DECK)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetTargetRange(1,0)
e4:SetValue(1)
Duel.RegisterEffect(e4,1-player_ai)

local e5=Effect.GlobalEffect()
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetCode(EFFECT_CANNOT_LOSE_EFFECT)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(1,0)
e5:SetValue(1)
Duel.RegisterEffect(e5,1-player_ai)

local e6=Effect.GlobalEffect()
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetCode(EFFECT_HAND_LIMIT)
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e6:SetTargetRange(1,0)
e6:SetValue(10)
Duel.RegisterEffect(e6,1-player_ai)

local e7=Effect.GlobalEffect(c)
e7:SetType(EFFECT_TYPE_FIELD)
e7:SetCode(EFFECT_UPDATE_ATTACK)
e7:SetRange(LOCATION_FZONE)
e7:SetTargetRange(LOCATION_MZONE,0)
e7:SetValue(500)
Duel.RegisterEffect(e7,1-player_ai)

local e8=Effect.GlobalEffect(c)
e8:SetType(EFFECT_TYPE_FIELD)
e8:SetCode(EFFECT_UPDATE_DEFENSE)
e8:SetRange(LOCATION_FZONE)
e8:SetTargetRange(LOCATION_MZONE,0)
e8:SetValue(500)
Duel.RegisterEffect(e8,1-player_ai)

local e9=Effect.GlobalEffect(c)
e9:SetType(EFFECT_TYPE_FIELD)
e9:SetCode(EFFECT_UPDATE_LEVEL)
e9:SetRange(LOCATION_FZONE)
e9:SetTargetRange(LOCATION_HAND,0)
e9:SetValue(0)
Duel.RegisterEffect(e9,1-player_ai)

local e10=Effect.GlobalEffect(c)
e10:SetType(EFFECT_TYPE_FIELD)
e10:SetCode(EFFECT_DOUBLE_TRIBUTE)
e10:SetRange(LOCATION_FZONE)
e10:SetTargetRange(LOCATION_MZONE,0)
e10:SetValue(1)
Duel.RegisterEffect(e10,1-player_ai)

local e11=Effect.GlobalEffect(c)
e11:SetType(EFFECT_TYPE_FIELD)
e11:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e11:SetRange(LOCATION_FZONE)
e11:SetTargetRange(LOCATION_MZONE,0)
e11:SetValue(1)
Duel.RegisterEffect(e11,1-player_ai)

local e12=Effect.GlobalEffect(c)
e12:SetType(EFFECT_TYPE_FIELD)
e12:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e12:SetRange(LOCATION_FZONE)
e12:SetTargetRange(LOCATION_MZONE,0)
e12:SetValue(1)
Duel.RegisterEffect(e12,1-player_ai)

local e13=Effect.GlobalEffect(c)
e13:SetType(EFFECT_TYPE_FIELD)
e13:SetCode(EFFECT_PUBLIC)
e13:SetRange(LOCATION_FZONE)
e13:SetTargetRange(0,LOCATION_HAND)
e13:SetValue(1)
Duel.RegisterEffect(e13,1-player_ai)

local e14=Effect.GlobalEffect(c)
e14:SetType(EFFECT_TYPE_FIELD)
e14:SetCode(EFFECT_DECREASE_TRIBUTE)
e14:SetRange(LOCATION_FZONE)
e14:SetTargetRange(0x6,0)
e14:SetValue(1)
Duel.RegisterEffect(e14,1-player_ai)

local e15=Effect.GlobalEffect(c)
e15:SetType(EFFECT_TYPE_FIELD)
e15:SetCode(EFFECT_DEFENSE_ATTACK)
e15:SetRange(LOCATION_FZONE)
e15:SetTargetRange(LOCATION_MZONE,0)
e15:SetValue(1)
Duel.RegisterEffect(e15,1-player_ai)

local e16=Effect.GlobalEffect()
e16:SetType(EFFECT_TYPE_FIELD)
e16:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE)
e16:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e16:SetTargetRange(1,0)
e16:SetValue(1)
Duel.RegisterEffect(e16,1-player_ai)

local e17=Effect.GlobalEffect(c)
e17:SetType(EFFECT_TYPE_FIELD)
e17:SetCode(EFFECT_LPCOST_CHANGE)
e17:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e17:SetRange(LOCATION_FZONE)
e17:SetTargetRange(1,0)
e17:SetValue(1)
Duel.RegisterEffect(e17,1-player_ai)

local e18=Effect.GlobalEffect(c)
e18:SetType(EFFECT_TYPE_FIELD)
e18:SetCode(EFFECT_DISABLE)
e18:SetRange(LOCATION_FZONE)
e18:SetTargetRange(0,LOCATION_MZONE)
e18:SetValue(1)
Duel.RegisterEffect(e18,1-player_ai)

local e19=Effect.GlobalEffect(c)
e19:SetType(EFFECT_TYPE_FIELD)
e19:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e19:SetRange(LOCATION_FZONE)
e19:SetTargetRange(LOCATION_MZONE,0)
e19:SetValue(LOCATION_HAND)
Duel.RegisterEffect(e19,1-player_ai)

local e20=Effect.GlobalEffect(c)
e20:SetType(EFFECT_TYPE_FIELD)
e20:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e20:SetRange(LOCATION_FZONE)
e20:SetTargetRange(LOCATION_HAND,0)
e20:SetValue(1)
Duel.RegisterEffect(e20,1-player_ai)

local e21=Effect.GlobalEffect(c)
e21:SetType(EFFECT_TYPE_FIELD)
e21:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
e21:SetRange(LOCATION_FZONE)
e21:SetTargetRange(LOCATION_MZONE,0)
e21:SetValue(1)
Duel.RegisterEffect(e21,1-player_ai)

local e22=Effect.GlobalEffect(c)
e22:SetType(EFFECT_TYPE_FIELD)
e22:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e22:SetRange(LOCATION_FZONE)
e22:SetTargetRange(LOCATION_MZONE,0)
e22:SetValue(1)
Duel.RegisterEffect(e22,1-player_ai)

local e23=Effect.GlobalEffect()
e23:SetType(EFFECT_TYPE_FIELD)
e23:SetCode(EFFECT_REVERSE_DAMAGE)
e23:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e23:SetTargetRange(1,0)
e23:SetValue(1)
Duel.RegisterEffect(e23,1-player_ai)

local e24=Effect.GlobalEffect()
e24:SetType(EFFECT_TYPE_FIELD)
e24:SetCode(EFFECT_PIERCE)
e24:SetRange(LOCATION_FZONE)
e24:SetTargetRange(LOCATION_MZONE,0)
e24:SetValue(1)
Duel.RegisterEffect(e24,1-player_ai)

local e25=Effect.GlobalEffect()
e25:SetType(EFFECT_TYPE_FIELD)
e25:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e25:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e25:SetTargetRange(1,0)
e25:SetValue(1)
Duel.RegisterEffect(e25,1-player_ai)

local e26=Effect.GlobalEffect()
e26:SetType(EFFECT_TYPE_FIELD)
e26:SetCode(EFFECT_CHANGE_DAMAGE)
e26:SetRange(LOCATION_FZONE)
e26:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e26:SetTargetRange(1,0)
e26:SetValue(0)
Duel.RegisterEffect(e26,1-player_ai)
local e27=e26:clone()
e27:SetCode(EFFECT_NO_EFFECT_DAMAGE)
Duel.RegisterEffect(e27,1-player-ai)

local e28=Effect.GlobalEffect(c)
e28:SetType(EFFECT_TYPE_FIELD)
e28:SetCode(EFFECT_DIRECT_ATTACK)
e28:SetRange(LOCATION_FZONE)
e28:SetTargetRange(LOCATION_ONFIELD,0)
e28:SetValue(1)
Duel.RegisterEffect(e28,1-player_ai)

local e29=Effect.GlobalEffect(c)
e29:SetType(EFFECT_TYPE_FIELD)
e29:SetCode(EFFECT_CANNOT_TRIGGER)
e29:SetRange(LOCATION_FZONE)
e29:SetTargetRange(0,0xFF)
e29:SetValue(1)
Duel.RegisterEffect(e29,1-player_ai)

local e30=Effect.GlobalEffect(c)
e30:SetType(EFFECT_TYPE_FIELD)
e30:SetCode(EFFECT_CANNOT_ATTACK)
e30:SetRange(LOCATION_FZONE)
e30:SetTargetRange(0,LOCATION_MZONE)
e30:SetValue(1)
Duel.RegisterEffect(e30,1-player_ai)
end
File Attachment(s):
ai-cheatingplayer.lua (2kb) downloaded 25 time(s).

You cannot view/download attachments. Try to login or register.
salvadorc17
2018-01-25T20:41:01Z
Why you want to make things easier, it would be better to make Cheating AI be more difficult.
BananaPhone42
2018-01-25T23:53:56Z
Originally Posted by: salvadorc17 

Why you want to make things easier, it would be better to make Cheating AI be more difficult.



While you have a point there, this is honestly just a "for fun" thing; I just did it 'cause I could. I mean, you don't have to use it, y'know? 'Sides, if there can be a "Cheating AI", why not give the player that ability?
Hippocampus1901
2018-01-26T17:48:27Z
Hi BananaPhone42,

What do you mean by "Special Summon Monsters 5 times"? You already can special summon monsters as many times as you like per turn. If you want to cap this amount, have you tried looking at the scripts of cards like Summon Limit or Scary Moth?
BananaPhone42
2018-01-26T19:41:25Z
Originally Posted by: Hippocampus1901 

Hi BananaPhone42,

What do you mean by "Special Summon Monsters 5 times"? You already can special summon monsters as many times as you like per turn. If you want to cap this amount, have you tried looking at the scripts of cards like Summon Limit or Scary Moth?



Sorry if I'm too vague for you. I mean, y'know how you can Normal Summon/Set a monster, right? I meant like, "Special Summon Monsters 5 times in the same manner that you can Normal Summon." or "Special Summon anytime, without needing a card's effect."

That clear enough for ya?

But, honestly... I can't seem to get the "Normal Summon high level monsters without Tributing (e.g., Summon Blue-Eyes White Dragon without sacrificing 2 Monsters)." working for the AI, no matter what I type in. I tried "EFFECT_DECREASE_TRIBUTE", but that didn't work.
salvadorc17
2018-01-28T20:39:58Z
The card of Emperor allow to Summon the level 5 or more monsters. When i created this ai in first version, i was not considering that, but after was good addition.
BananaPhone42
2018-01-29T03:40:08Z
Originally Posted by: salvadorc17 

The card of Emperor allow to Summon the level 5 or more monsters. When i created this ai in first version, i was not considering that, but after was good addition.



When you say "The Card of Emperor", do you mean the Mausoleum of the Emperor's effect? That's the only card I know that allows you to Summon higher ranking monsters without sacrificing, but in exchange you pay LP.
BananaPhone42
2018-02-06T00:37:00Z
So... does anyone know how to get Ancient Rules to work for my A.I.?

BananaPhone42
2018-02-06T19:41:54Z
Because of what I found in searching for a cheating AI, I was able to find a way to increase your Hand capacity. See above for details.
salvadorc17
2018-02-06T20:39:21Z
Sorry to say this, but none is longer interested about ancient rules, youre wasting time..
BananaPhone42
2018-02-06T22:21:58Z
Originally Posted by: salvadorc17 

Sorry to say this, but none is longer interested about ancient rules, youre wasting time..



Touche, however I must inform you that I've plenty of time on my hands, so I don't really care much (not to sound like a prick)... I don't really know how to implement Mausoleum of the Emperor's effect into AI. Same thing with Cost Down.
BananaPhone42
2018-02-11T01:05:42Z
You want to have a permanent ATK/DEF boost? Well, with my new discovery, you most certainly can. See the first post for details. If you want to give these to your opponent instead, then give me a holler and I'll tell you how to.
BananaPhone42
2018-02-11T09:32:13Z
Originally Posted by: salvadorc17 

Sorry to say this, but none is longer interested about ancient rules, youre wasting time..



I don't mean to brag, but uh... what was that about "wasting my time", Sal? I found out how to do everything I wanted and then some~. I'd say this little venture was quite fruitful. [:wink:]
salvadorc17
2018-02-12T20:58:59Z
Right, i know you can learn scripting doing this, but in terms of usability is not good for others, they would prefer harder AI mode, with more challenges..
BananaPhone42
2018-02-12T21:44:52Z
Originally Posted by: salvadorc17 

Right, i know you can learn scripting doing this, but in terms of usability is not good for others, they would prefer harder AI mode, with more challenges..



Fair enough, but these unfair advantages can be applied to the computer player. Just thought I'd point this out, and I can tell you how if you like?
kvanir
2018-06-21T04:38:21Z
How do I rewrite to give all these functions to AI instead?
BananaPhone42
2018-06-23T12:53:14Z
For anyone who cares to know, you can now Directly Attack your opponent. Secondly, for the effects to work for your opponent and not you, you merely need to reverse the "LOCATION_XXX,0" to "0,LOCATION_XXX" (XXX meaing MZONE, in this case.) Same thing for the "1,0" effects; change it to "0,1".
kiwi946
2018-06-26T12:53:09Z
Is Percy AI Support link summon now?
Why not start a AI with link summon?

BananaPhone42
2018-06-26T15:00:15Z
Originally Posted by: kiwi946 

github here:
https://github.com/IceYGO/windbot 



What's the point of advertising that here, if you don't mind me asking?

Originally Posted by: kiwi946 

Is Percy AI Support link summon now?
Why not start a AI with link summon?



https://twitter.com/Ygop...tatus/975054083114590208  Many people have said numerous times that Percy's still working on the AI for the Link Summon support. For your second question, you're kidding, right? The version that can be download as of right now has no offline AI Support, never mind Link Support. Also, I do not know how to build an AI; I just put effects that can be used to your advantage against the AI for 1.033.D(a)